In [1]:
import os
os.environ['USE_PYGEOS'] = '0'

import geopandas as gpd
from  fiona import listlayers

#maps
canadaMaps='https://github.com/AnaLuciaChamorro/geoCanadadf/raw/main/maps/countryMaps.gpkg'

#layers in maps
listlayers(canadaMaps)
Out[1]:
['provinces', 'cities', 'rivers', 'lakes', 'road']
In [3]:
#obtenemos las capas de cada mapa
provinces=gpd.read_file(canadaMaps,layer='provinces')
cities=gpd.read_file(canadaMaps,layer='cities')
rivers=gpd.read_file(canadaMaps,layer='rivers')
lakes=gpd.read_file(canadaMaps,layer='lakes')
road=gpd.read_file(canadaMaps,layer='road')
In [4]:
#verificamos que las capas tengan el mismo crs
provinces.crs.to_epsg()==cities.crs.to_epsg()==rivers.crs.to_epsg()==lakes.crs.to_epsg()==road.crs.to_epsg()
Out[4]:
True
In [5]:
# trabajaremos con Alberta
alberta=provinces[provinces.PROVINCIA=='Alberta']

# clipping
cities_clipped = cities.clip(alberta)
rivers_clipped = rivers.clip(alberta)
lakes_clipped = lakes.clip(alberta)
road_clipped = road.clip(alberta)

# plotting
base = alberta.plot(facecolor="lightcyan", edgecolor='gray', linewidth=0.4,figsize=(5,5))
cities_clipped.plot(marker='*', color='deeppink', markersize=15,ax=base)
rivers_clipped.plot(edgecolor='steelblue', linewidth=0.3,ax=base)
lakes_clipped.plot(facecolor="thistle", edgecolor='gray', linewidth=0.4,figsize=(5,5), markersize=15,ax=base)
road_clipped.plot(edgecolor='mediumpurple', linewidth=0.5,ax=base)
Out[5]:
<Axes: >
In [6]:
#Ejercicio 1
In [7]:
# unit is in degrees:
alberta.crs.axis_info
Out[7]:
[Axis(name=Geodetic latitude, abbrev=Lat, direction=north, unit_auth_code=EPSG, unit_code=9122, unit_name=degree),
 Axis(name=Geodetic longitude, abbrev=Lon, direction=east, unit_auth_code=EPSG, unit_code=9122, unit_name=degree)]
In [8]:
# centroide
alberta.centroid
C:\Users\USUARIO}\AppData\Local\Temp\ipykernel_4744\3039830095.py:2: UserWarning: Geometry is in a geographic CRS. Results from 'centroid' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation.

  alberta.centroid
Out[8]:
5    POINT (-114.50705 55.16362)
dtype: geometry
In [9]:
#buscamos la proyección del centroide
alberta.to_crs(3402).crs.axis_info
Out[9]:
[Axis(name=Easting, abbrev=E, direction=east, unit_auth_code=EPSG, unit_code=9001, unit_name=metre),
 Axis(name=Northing, abbrev=N, direction=north, unit_auth_code=EPSG, unit_code=9001, unit_name=metre)]
In [10]:
alberta.to_crs(3402).centroid
Out[10]:
5    POINT (537992.852 6093895.213)
dtype: geometry
In [11]:
base3402=alberta.to_crs(3402).plot()
alberta.to_crs(3402).centroid.plot(color='red',ax=base3402)
Out[11]:
<Axes: >
In [12]:
from matplotlib import pyplot

fig, (ax1, ax2) = pyplot.subplots(ncols=2, sharex=False, sharey=False, figsize=(12,12))

ax1.set_title('projected (3402)',fontsize=10)
alberta.to_crs(3402).plot(ax=ax1)
alberta.to_crs(3402).centroid.plot(color='red',ax=ax1)

ax2.set_title('unprojected',fontsize=10)
alberta.plot(ax=ax2)
alberta.centroid.plot(color='red',ax=ax2)
C:\Users\USUARIO}\AppData\Local\Temp\ipykernel_4744\3859655629.py:11: UserWarning: Geometry is in a geographic CRS. Results from 'centroid' are likely incorrect. Use 'GeoSeries.to_crs()' to re-project geometries to a projected CRS before this operation.

  alberta.centroid.plot(color='red',ax=ax2)
Out[12]:
<Axes: title={'center': 'unprojected'}>
In [13]:
alberta_3402=alberta.to_crs(3402)
# solo alberta

cities_3402=cities.to_crs(alberta_3402.crs)
cities_3402=cities_3402[cities_3402.PROVINCIA=='Alberta']

rivers_3402=rivers.to_crs(alberta_3402.crs)
rivers_3402=gpd.clip(gdf=rivers_3402,mask=alberta_3402)

lakes_3402=lakes.to_crs(alberta_3402.crs)
lakes_3402=gpd.clip(gdf=lakes_3402,mask=alberta_3402)

road_3402=road.to_crs(alberta_3402.crs)
road_3402=gpd.clip(gdf=road_3402,mask=alberta_3402)
In [14]:
# guardamos como gpkg
import os

alberta_3402.to_file(os.path.join("maps","albertaMaps_3402.gpkg"), layer='provinces', driver="GPKG")
cities_3402.to_file(os.path.join("maps","albertaMaps_3402.gpkg"), layer='cities', driver="GPKG")
rivers_3402.to_file(os.path.join("maps","albertaMaps_3402.gpkg"), layer='rivers', driver="GPKG")
lakes_3402.to_file(os.path.join("maps","albertaMaps_3402.gpkg"), layer='lakes', driver="GPKG")
road_3402.to_file(os.path.join("maps","albertaMaps_3402.gpkg"), layer='road', driver="GPKG")
In [15]:
# Ejercicio 2
In [146]:
#verificamos que sea un multipolígono
alberta_3402
Out[146]:
CÓDIGO PROVINCIA geometry
5 CA01 Alberta POLYGON ((827410.883 5993333.680, 865400.104 5...
In [17]:
# como Alberta no es multipolígono, elegimos otra provincia
provinces
Out[17]:
CÓDIGO PROVINCIA geometry
0 CA10 Quebec MULTIPOLYGON (((-70.90417 46.91360, -71.13028 ...
1 CA13 Nunavut MULTIPOLYGON (((-79.32224 52.03166, -79.31973 ...
2 CA06 Territorios del Noroeste MULTIPOLYGON (((-135.33780 69.38861, -135.3394...
3 CA07 Nueva Escocia MULTIPOLYGON (((-66.76112 44.67610, -66.90028 ...
4 CA11 Saskatchewan POLYGON ((-104.70990 59.99977, -104.27070 59.9...
5 CA01 Alberta POLYGON ((-110.00050 54.00573, -110.00140 49.0...
6 CA05 Labrador y Terranova MULTIPOLYGON (((-54.12500 47.64083, -54.24333 ...
7 CA02 Columbia Británica MULTIPOLYGON (((-123.57720 48.92916, -123.4339...
8 CA04 Nuevo Brunswick MULTIPOLYGON (((-64.48277 47.91777, -64.51472 ...
9 CA09 Isla del Príncipe Eduardo POLYGON ((-63.88222 46.64555, -63.90417 46.603...
10 CA12 Yukón MULTIPOLYGON (((-141.00301 69.64236, -140.3961...
11 CA03 Manitoba POLYGON ((-102.00170 59.99992, -100.03900 59.9...
12 CA08 Ontario MULTIPOLYGON (((-82.81000 45.99249, -82.84222 ...
In [21]:
#Quebec
quebec=provinces[provinces.PROVINCIA=='Quebec']
base32098=quebec.to_crs(32098).plot()
quebec.to_crs(32098).centroid.plot(color='red',ax=base32098)
Out[21]:
<Axes: >
In [23]:
quebec_32098=quebec.to_crs(32098)
#Obtenemos solo el borde de Quebec
quebec_32098.boundary
Out[23]:
0    MULTILINESTRING ((-182833.642 327289.291, -200...
dtype: geometry
In [24]:
type(quebec_32098.boundary)
Out[24]:
geopandas.geoseries.GeoSeries
In [43]:
#borde de Quebec
quebec_32098.boundary.plot()
Out[43]:
<Axes: >
In [25]:
# convertimos en GDF y lo guardamos
quebec_32098DF=quebec_32098.boundary.to_frame()
In [26]:
#nueva columna
quebec_32098DF['name']='Quebec' 

# Renombramos el nombre de la columna
quebec_32098DF.rename(columns={0:'geometry'},inplace=True) 

#definimos la geometría
quebec_32098DF = quebec_32098DF.set_geometry("geometry")

# verificamos
quebec_32098DF.crs
Out[26]:
<Projected CRS: EPSG:32098>
Name: NAD27 / Quebec Lambert
Axis Info [cartesian]:
- X[east]: Easting (metre)
- Y[north]: Northing (metre)
Area of Use:
- name: Canada - Quebec.
- bounds: (-79.85, 44.99, -57.1, 62.62)
Coordinate Operation:
- name: Quebec Lambert Projection
- method: Lambert Conic Conformal (2SP)
Datum: North American Datum 1927
- Ellipsoid: Clarke 1866
- Prime Meridian: Greenwich
In [151]:
#Ejercicio 3
In [22]:
#Ahora trabajaremos con Canadá, para ellos utilizaremos el siguiente código (A nivel mundial)
worldMaps='https://github.com/CienciaDeDatosEspacial/code_and_data/raw/main/maps/worldMaps.gpkg'

#layers con los mapas
listlayers(worldMaps)
Out[22]:
['countries', 'cities', 'rivers']
In [23]:
#obtenemos las capas de cada mapa del mundo
countries=gpd.read_file(worldMaps,layer='countries')
cities=gpd.read_file(worldMaps,layer='cities')
rivers=gpd.read_file(worldMaps,layer='rivers')
In [24]:
#verificamos que las capas tengan el mismo crs
countries.crs.to_epsg()==cities.crs.to_epsg()==rivers.crs.to_epsg()
Out[24]:
True
In [25]:
# trabajaremos con Canada
canada=countries[countries.COUNTRY=='Canada']

# seleccionamos solo la parte con la que trabajaremos
canada_cities= gpd.clip(gdf=cities,mask=canada)
canada_rivers = gpd.clip(gdf=rivers,mask=canada)

# ploteamos nuestro mapa
base = canada.plot(facecolor="lightcyan", edgecolor='gray', linewidth=0.4,figsize=(5,5))
canada_cities.plot(marker='*', color='deeppink', markersize=15,ax=base)
canada_rivers.plot(edgecolor='mediumpurple', linewidth=0.5,ax=base)
Out[25]:
<Axes: >
In [49]:
#buscamos la proyección del centroide
canada.to_crs(3347).crs.axis_info
Out[49]:
[Axis(name=Easting, abbrev=E, direction=east, unit_auth_code=EPSG, unit_code=9001, unit_name=metre),
 Axis(name=Northing, abbrev=N, direction=north, unit_auth_code=EPSG, unit_code=9001, unit_name=metre)]
In [52]:
canada.to_crs(3347).centroid

#ploteamos la versión proyectada con el centroide de Canadá
base3347=canada.to_crs(3347).plot()
canada.to_crs(3347).centroid.plot(color='red',ax=base3347)
Out[52]:
<Axes: >
In [2]:
#Buscamos información para obtener las provincias y censos de Canadá
canada_provinces=gpd.read_file(os.path.join("maps","lpr_000b21a_e","lpr_000b21a_e.shp"))
In [34]:
canada_provinces.crs
Out[34]:
<Projected CRS: EPSG:3347>
Name: NAD83 / Statistics Canada Lambert
Axis Info [cartesian]:
- E[east]: Easting (metre)
- N[north]: Northing (metre)
Area of Use:
- name: Canada - onshore and offshore - Alberta; British Columbia; Manitoba; New Brunswick; Newfoundland and Labrador; Northwest Territories; Nova Scotia; Nunavut; Ontario; Prince Edward Island; Quebec; Saskatchewan; Yukon.
- bounds: (-141.01, 38.21, -40.73, 86.46)
Coordinate Operation:
- name: Statistics Canada Lambert
- method: Lambert Conic Conformal (2SP)
Datum: North American Datum 1983
- Ellipsoid: GRS 1980
- Prime Meridian: Greenwich
In [35]:
canada_provinces
Out[35]:
PRUID DGUID PRNAME PRENAME PRFNAME PREABBR PRFABBR LANDAREA geometry
0 10 2021A000210 Newfoundland and Labrador / Terre-Neuve-et-Lab... Newfoundland and Labrador Terre-Neuve-et-Labrador N.L. T.-N.-L. 3.581704e+05 MULTIPOLYGON (((8841194.729 2213093.663, 88411...
1 11 2021A000211 Prince Edward Island / Île-du-Prince-Édouard Prince Edward Island Île-du-Prince-Édouard P.E.I. Î.-P.-É. 5.681179e+03 MULTIPOLYGON (((8374335.443 1629502.597, 83743...
2 12 2021A000212 Nova Scotia / Nouvelle-Écosse Nova Scotia Nouvelle-Écosse N.S. N.-É. 5.282471e+04 MULTIPOLYGON (((8310463.217 1250722.263, 83104...
3 13 2021A000213 New Brunswick / Nouveau-Brunswick New Brunswick Nouveau-Brunswick N.B. N.-B. 7.124850e+04 MULTIPOLYGON (((7964100.720 1576822.289, 79641...
4 24 2021A000224 Quebec / Québec Quebec Québec Que. Qc 1.298600e+06 MULTIPOLYGON (((6948393.211 2760814.626, 69483...
5 35 2021A000235 Ontario Ontario Ontario Ont. Ont. 8.924118e+05 MULTIPOLYGON (((7146731.034 1071348.914, 71467...
6 46 2021A000246 Manitoba Manitoba Manitoba Man. Man. 5.403102e+05 MULTIPOLYGON (((6036427.023 2552091.071, 60364...
7 47 2021A000247 Saskatchewan Saskatchewan Saskatchewan Sask. Sask. 5.770604e+05 POLYGON ((5248633.914 2767057.263, 5249285.640...
8 48 2021A000248 Alberta Alberta Alberta Alta. Alb. 6.346583e+05 POLYGON ((5228304.177 2767597.891, 5228098.463...
9 59 2021A000259 British Columbia / Colombie-Britannique British Columbia Colombie-Britannique B.C. C.-B. 9.206866e+05 MULTIPOLYGON (((3843551.097 2389750.100, 38435...
10 60 2021A000260 Yukon Yukon Yukon Y.T. Yn 4.723454e+05 MULTIPOLYGON (((4573723.537 4214993.163, 45737...
11 61 2021A000261 Northwest Territories / Territoires du Nord-Ouest Northwest Territories Territoires du Nord-Ouest N.W.T. T.N.-O. 1.127712e+06 MULTIPOLYGON (((5484328.789 3866905.254, 54843...
12 62 2021A000262 Nunavut Nunavut Nunavut Nvt. Nt 1.836994e+06 MULTIPOLYGON (((6990267.260 1768670.111, 69902...
In [3]:
canada_census=gpd.read_file(os.path.join("maps","lcd_000b21a_e","lcd_000b21a_e.shp"))
In [37]:
canada_census
Out[37]:
CDUID DGUID CDNAME CDTYPE LANDAREA PRUID geometry
0 1001 2021A00031001 Division No. 1 CDR 9104.5799 10 MULTIPOLYGON (((8991051.954 2038839.069, 89910...
1 1002 2021A00031002 Division No. 2 CDR 5915.5695 10 MULTIPOLYGON (((8887835.569 2084264.706, 88878...
2 1003 2021A00031003 Division No. 3 CDR 19272.1069 10 MULTIPOLYGON (((8666126.603 1955816.189, 86661...
3 1004 2021A00031004 Division No. 4 CDR 7019.9723 10 MULTIPOLYGON (((8536466.374 1926979.874, 85364...
4 1005 2021A00031005 Division No. 5 CDR 10293.7618 10 MULTIPOLYGON (((8528149.243 2085441.331, 85281...
... ... ... ... ... ... ... ...
288 6105 2021A00036105 Region 5 REG 152135.9223 61 POLYGON ((5316301.989 3076090.949, 5332928.611...
289 6106 2021A00036106 Region 6 REG 182201.5022 61 POLYGON ((5233904.580 3460235.340, 5284583.063...
290 6204 2021A00036204 Qikiqtaaluk REG 970554.6112 62 MULTIPOLYGON (((6990267.260 1768670.111, 69902...
291 6205 2021A00036205 Kivalliq REG 434331.1614 62 MULTIPOLYGON (((6046392.443 2518833.014, 60464...
292 6208 2021A00036208 Kitikmeot REG 432108.0040 62 MULTIPOLYGON (((5541699.500 3510034.311, 55416...

293 rows × 7 columns

In [39]:
canada_census.crs
Out[39]:
<Projected CRS: EPSG:3347>
Name: NAD83 / Statistics Canada Lambert
Axis Info [cartesian]:
- E[east]: Easting (metre)
- N[north]: Northing (metre)
Area of Use:
- name: Canada - onshore and offshore - Alberta; British Columbia; Manitoba; New Brunswick; Newfoundland and Labrador; Northwest Territories; Nova Scotia; Nunavut; Ontario; Prince Edward Island; Quebec; Saskatchewan; Yukon.
- bounds: (-141.01, 38.21, -40.73, 86.46)
Coordinate Operation:
- name: Statistics Canada Lambert
- method: Lambert Conic Conformal (2SP)
Datum: North American Datum 1983
- Ellipsoid: GRS 1980
- Prime Meridian: Greenwich
In [54]:
#plotemaos el mapa de Canadá provincias y censos
fig, (ax1, ax2) = pyplot.subplots(ncols=2, sharex=False, sharey=False, figsize=(12,12))

canada_provinces.plot(ax=ax1, facecolor='lightgrey', edgecolor='black')
canada_census.plot(ax=ax2, facecolor='lightgrey', edgecolor='black',linewidth=0.2)
In [57]:
#Como los crs de los censos y las provincias de Canadá coinciden, no necesitamos cambiarlos
#Ahora lo guardamos los layers obtenidos
canada_provinces.to_file(os.path.join("maps","canada_provinces_3347.gpkg"), layer='provinces', driver="GPKG")
canada_census.to_file(os.path.join("maps","canada_census_3347.gpkg"), layer='census', driver="GPKG")
In [58]:
#Ejercicio 4
In [91]:
#Asignamos el crs de nuestro país a la siguiente variable
canada_3347=canada.to_crs(3347)
In [62]:
centroCanada=canada_3347.centroid
#Dividiremos nuestro mapa en norte y sur 
fig, axs = pyplot.subplots(ncols=2,sharex=False, sharey=False,figsize=(8,8))

axs[0].set_title('Above_Centroid',fontsize=5)
canada_census.cx[:, centroCanada.y:].plot(ax=axs[0]) 

axs[1].set_title('Below_Centroid',fontsize=5)
canada_census.cx[:, :centroCanada.y].plot(ax=axs[1]) 
C:\Users\USUARIO}\.conda\envs\geopandas\lib\site-packages\shapely\geometry\polygon.py:91: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  return [float(c) for c in o]
C:\Users\USUARIO}\.conda\envs\geopandas\lib\site-packages\shapely\geometry\polygon.py:91: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  return [float(c) for c in o]
Out[62]:
<Axes: title={'center': 'Below_Centroid'}>
In [63]:
#Dividiremos nuestro mapa en norte y sur 
fig, axs = pyplot.subplots(ncols=2,sharex=False, sharey=False,figsize=(8,8))

axs[0].set_title('Above_Centroid',fontsize=5)
canada_provinces.cx[:, centroCanada.y:].plot(ax=axs[0]) 

axs[1].set_title('Below_Centroid',fontsize=5)
canada_provinces.cx[:, :centroCanada.y].plot(ax=axs[1]) 
C:\Users\USUARIO}\.conda\envs\geopandas\lib\site-packages\shapely\geometry\polygon.py:91: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  return [float(c) for c in o]
C:\Users\USUARIO}\.conda\envs\geopandas\lib\site-packages\shapely\geometry\polygon.py:91: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  return [float(c) for c in o]
Out[63]:
<Axes: title={'center': 'Below_Centroid'}>
In [67]:
#Trabjaremos con el norte de nuestro país
Canada_topNorth=canada_census.cx[:,centroCanada.y:].dissolve()
Canada_topNorth
C:\Users\USUARIO}\.conda\envs\geopandas\lib\site-packages\shapely\geometry\polygon.py:91: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  return [float(c) for c in o]
Out[67]:
geometry CDUID DGUID CDNAME CDTYPE LANDAREA PRUID
0 MULTIPOLYGON (((3698565.423 2568543.540, 36985... 1010 2021A00031010 Division No. 10 CDR 191691.0863 10
In [70]:
#Graficamos el norte de Canadá
Canada_topNorth['zone']='N'
Canada_topNorth=Canada_topNorth.loc[:,['CDNAME','zone','geometry']]   
Canada_topNorth
Out[70]:
CDNAME zone geometry
0 Division No. 10 N MULTIPOLYGON (((3698565.423 2568543.540, 36985...
In [71]:
#Ploteamos
Canada_topNorth.plot()
Out[71]:
<Axes: >
In [72]:
rowsCX=(canada_census.cx[:,centroCanada.y:].shape[0],\
canada_census.cx[:, :centroCanada.y].shape[0])
sum(rowsCX)
C:\Users\USUARIO}\.conda\envs\geopandas\lib\site-packages\shapely\geometry\polygon.py:91: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  return [float(c) for c in o]
C:\Users\USUARIO}\.conda\envs\geopandas\lib\site-packages\shapely\geometry\polygon.py:91: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead
  return [float(c) for c in o]
Out[72]:
306
In [73]:
sum(rowsCX)-canada_census.shape[0]
#Se repiten 13 censos
Out[73]:
13
In [74]:
#Ejercicio 5 (extra)
In [6]:
import pandas as pd 
infoairports=pd.read_csv(os.path.join("data","ca-airports.csv"))

#algunas filas
infoairports.iloc[[0,1,2,3,-4,-3,-2,-1],:]
Out[6]:
id ident type name latitude_deg longitude_deg elevation_ft continent country_name iso_country ... municipality scheduled_service gps_code iata_code local_code home_link wikipedia_link keywords score last_updated
0 #meta +id #meta +code #loc +airport +type #loc +airport +name #geo +lat #geo +lon #geo +elevation +ft #region +continent +code #country +name #country +code +iso2 ... #loc +municipality +name #status +scheduled #loc +airport +code +gps #loc +airport +code +iata #loc +airport +code +local #meta +url +airport #meta +url +wikipedia #meta +keywords #meta +score #date +updated
1 1990 CYYZ large_airport Toronto Lester B. Pearson International Airport 43.6772 -79.6306 569 NaN Canada CA ... Toronto 1 CYYZ YYZ YYZ http://www.gtaa.com/ https://en.wikipedia.org/wiki/Toronto_Pearson_... YTO, Toronto International Airport, Malton 1040275 2023-05-11T14:58:13+00:00
2 1941 CYVR large_airport Vancouver International Airport 49.193901062 -123.183998108 14 NaN Canada CA ... Vancouver 1 CYVR YVR NaN http://www.yvr.ca/ https://en.wikipedia.org/wiki/Vancouver_Intern... NaN 1018875 2013-07-22T11:09:16+00:00
3 1928 CYUL large_airport Montreal / Pierre Elliott Trudeau Internationa... 45.4706001282 -73.7407989502 118 NaN Canada CA ... Montréal 1 CYUL YUL YUL http://www.admtl.com/passager/Home.aspx https://en.wikipedia.org/wiki/Montr%C3%A9al-Pi... YMQ, Dorval Airport 51875 2014-03-16T22:14:44+00:00
3030 320714 CA-0659 closed Yahk Aerodrome 49.109 -116.0598 2870 NaN Canada CA ... Yahk 0 NaN NaN NaN NaN NaN NaN 0 2022-11-23T12:47:24+00:00
3031 39705 CA-0059 closed Brazeau Airport 52.967817 -115.86737 NaN NaN Canada CA ... Yellowhead 0 NaN NaN NaN NaN NaN NaN 0 2021-02-18T17:19:40+00:00
3032 40067 CA-0421 closed E C Air Airport 51.53614 -111.19324 NaN NaN Canada CA ... Youngstown 0 NaN NaN NaN NaN NaN NaN 0 2022-12-03T06:44:57+00:00
3033 40068 CA-0422 closed Yoyo Airport 58.9258 -121.473201 1950 NaN Canada CA ... Yoyo 0 NaN NaN NaN NaN NaN BL8, BL8 0 2016-09-10T06:55:25+00:00

8 rows × 23 columns

In [7]:
# #eliminamos la primera fila
infoairports.drop(index=0,inplace=True)
infoairports.reset_index(drop=True, inplace=True)
infoairports.head()
Out[7]:
id ident type name latitude_deg longitude_deg elevation_ft continent country_name iso_country ... municipality scheduled_service gps_code iata_code local_code home_link wikipedia_link keywords score last_updated
0 1990 CYYZ large_airport Toronto Lester B. Pearson International Airport 43.6772 -79.6306 569 NaN Canada CA ... Toronto 1 CYYZ YYZ YYZ http://www.gtaa.com/ https://en.wikipedia.org/wiki/Toronto_Pearson_... YTO, Toronto International Airport, Malton 1040275 2023-05-11T14:58:13+00:00
1 1941 CYVR large_airport Vancouver International Airport 49.193901062 -123.183998108 14 NaN Canada CA ... Vancouver 1 CYVR YVR NaN http://www.yvr.ca/ https://en.wikipedia.org/wiki/Vancouver_Intern... NaN 1018875 2013-07-22T11:09:16+00:00
2 1928 CYUL large_airport Montreal / Pierre Elliott Trudeau Internationa... 45.4706001282 -73.7407989502 118 NaN Canada CA ... Montréal 1 CYUL YUL YUL http://www.admtl.com/passager/Home.aspx https://en.wikipedia.org/wiki/Montr%C3%A9al-Pi... YMQ, Dorval Airport 51875 2014-03-16T22:14:44+00:00
3 1973 CYYC large_airport Calgary International Airport 51.113899231 -114.019996643 3557 NaN Canada CA ... Calgary 1 CYYC YYC NaN http://www.calgaryairport.com/ https://en.wikipedia.org/wiki/Calgary_Internat... McCall Field 51275 2014-03-18T23:08:53+00:00
4 1840 CYOW large_airport Ottawa Macdonald-Cartier International Airport 45.322498 -75.669197 374 NaN Canada CA ... Ottawa 1 CYOW YOW YOW https://yow.ca/ https://en.wikipedia.org/wiki/Ottawa_Macdonald... Uplands, UUP, CUUP 1275 2022-11-06T16:37:56+00:00

5 rows × 23 columns

In [8]:
# verificamos que columna necesitaremos
infoairports.columns.to_list()
Out[8]:
['id',
 'ident',
 'type',
 'name',
 'latitude_deg',
 'longitude_deg',
 'elevation_ft',
 'continent',
 'country_name',
 'iso_country',
 'region_name',
 'iso_region',
 'local_region',
 'municipality',
 'scheduled_service',
 'gps_code',
 'iata_code',
 'local_code',
 'home_link',
 'wikipedia_link',
 'keywords',
 'score',
 'last_updated']
In [9]:
#nos quedaremos con las columnas: nombre, tipo, latitud, longitud, elevacion, nombre de la region y municipalidad
keep=['name','type','latitude_deg', 'longitude_deg','elevation_ft','region_name','municipality']
infoairports=infoairports.loc[:,keep]
In [10]:
#verificamos las columnas con las que nos quedamos (vemos el tipo)
infoairports.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 3033 entries, 0 to 3032
Data columns (total 7 columns):
 #   Column         Non-Null Count  Dtype 
---  ------         --------------  ----- 
 0   name           3033 non-null   object
 1   type           3033 non-null   object
 2   latitude_deg   3033 non-null   object
 3   longitude_deg  3033 non-null   object
 4   elevation_ft   2511 non-null   object
 5   region_name    3033 non-null   object
 6   municipality   2461 non-null   object
dtypes: object(7)
memory usage: 166.0+ KB
In [14]:
#cambiamos a numéricos las columnas de latitud, longitud y elevación
numericColumns=['latitude_deg', 'longitude_deg','elevation_ft']
infoairports[numericColumns]=infoairports.loc[:,numericColumns].apply(lambda x:pd.to_numeric(x))

#verificamos los cambios hechos
infoairports.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 3033 entries, 0 to 3032
Data columns (total 7 columns):
 #   Column         Non-Null Count  Dtype  
---  ------         --------------  -----  
 0   name           3033 non-null   object 
 1   type           3033 non-null   object 
 2   latitude_deg   3033 non-null   float64
 3   longitude_deg  3033 non-null   float64
 4   elevation_ft   2511 non-null   float64
 5   region_name    3033 non-null   object 
 6   municipality   2461 non-null   object 
dtypes: float64(3), object(4)
memory usage: 166.0+ KB
In [49]:
# realizamos el plot, no proyectado, es decir en grados
base = canada.plot(color='white', edgecolor='black')

infoairports.plot.scatter(x = 'longitude_deg', y = 'latitude_deg',ax=base)
Out[49]:
<Axes: xlabel='longitude_deg', ylabel='latitude_deg'>
In [38]:
infoairports
Out[38]:
name type latitude_deg longitude_deg elevation_ft region_name municipality
0 Toronto Lester B. Pearson International Airport large_airport 43.677200 -79.630600 569.0 Ontario Toronto
1 Vancouver International Airport large_airport 49.193901 -123.183998 14.0 British Columbia Vancouver
2 Montreal / Pierre Elliott Trudeau Internationa... large_airport 45.470600 -73.740799 118.0 Quebec Montréal
3 Calgary International Airport large_airport 51.113899 -114.019997 3557.0 Alberta Calgary
4 Ottawa Macdonald-Cartier International Airport large_airport 45.322498 -75.669197 374.0 Ontario Ottawa
... ... ... ... ... ... ... ...
3028 Cow Creek Airport closed 42.984340 -82.201140 643.0 Ontario Wyoming
3029 Yahk Aerodrome closed 49.109000 -116.059800 2870.0 British Columbia Yahk
3030 Brazeau Airport closed 52.967817 -115.867370 NaN Alberta Yellowhead
3031 E C Air Airport closed 51.536140 -111.193240 NaN Alberta Youngstown
3032 Yoyo Airport closed 58.925800 -121.473201 1950.0 British Columbia Yoyo

3033 rows × 7 columns

In [55]:
#Como observamos en el plot hay unos puntos que malogran el grafico, por eso buscamos en cual de las filas está una que se aleja de los valores promedios
filtro = (infoairports['latitude_deg'] < 20) & (infoairports['longitude_deg'] > -50)
resultados = infoairports[filtro]
print(resultados)
                                             name      type  latitude_deg  \
2739          (Duplicate)Little Red River Airport    closed          0.03   
2965  (Duplicate)Tofino Lifeboat Station Heliport  heliport          0.01   

      longitude_deg  elevation_ft       region_name           municipality  
2739          -0.05         845.0           Alberta  Little Red River Cree  
2965          -0.02           NaN  British Columbia                 Tofino  
In [56]:
#Ahora imprimimos todas nuestras filas para verificar los resultados anteriores
# Ajustar la opción de visualización para mostrar todas las filas
pd.set_option('display.max_rows', None)

# Aplicar el filtro
filtro = (infoairports['latitude_deg'] < 20) & (infoairports['longitude_deg'] > -50)

# Mostrar el resultado del filtro
print(filtro)
0       False
1       False
2       False
3       False
4       False
5       False
6       False
7       False
8       False
9       False
10      False
11      False
12      False
13      False
14      False
15      False
16      False
17      False
18      False
19      False
20      False
21      False
22      False
23      False
24      False
25      False
26      False
27      False
28      False
29      False
30      False
31      False
32      False
33      False
34      False
35      False
36      False
37      False
38      False
39      False
40      False
41      False
42      False
43      False
44      False
45      False
46      False
47      False
48      False
49      False
50      False
51      False
52      False
53      False
54      False
55      False
56      False
57      False
58      False
59      False
60      False
61      False
62      False
63      False
64      False
65      False
66      False
67      False
68      False
69      False
70      False
71      False
72      False
73      False
74      False
75      False
76      False
77      False
78      False
79      False
80      False
81      False
82      False
83      False
84      False
85      False
86      False
87      False
88      False
89      False
90      False
91      False
92      False
93      False
94      False
95      False
96      False
97      False
98      False
99      False
100     False
101     False
102     False
103     False
104     False
105     False
106     False
107     False
108     False
109     False
110     False
111     False
112     False
113     False
114     False
115     False
116     False
117     False
118     False
119     False
120     False
121     False
122     False
123     False
124     False
125     False
126     False
127     False
128     False
129     False
130     False
131     False
132     False
133     False
134     False
135     False
136     False
137     False
138     False
139     False
140     False
141     False
142     False
143     False
144     False
145     False
146     False
147     False
148     False
149     False
150     False
151     False
152     False
153     False
154     False
155     False
156     False
157     False
158     False
159     False
160     False
161     False
162     False
163     False
164     False
165     False
166     False
167     False
168     False
169     False
170     False
171     False
172     False
173     False
174     False
175     False
176     False
177     False
178     False
179     False
180     False
181     False
182     False
183     False
184     False
185     False
186     False
187     False
188     False
189     False
190     False
191     False
192     False
193     False
194     False
195     False
196     False
197     False
198     False
199     False
200     False
201     False
202     False
203     False
204     False
205     False
206     False
207     False
208     False
209     False
210     False
211     False
212     False
213     False
214     False
215     False
216     False
217     False
218     False
219     False
220     False
221     False
222     False
223     False
224     False
225     False
226     False
227     False
228     False
229     False
230     False
231     False
232     False
233     False
234     False
235     False
236     False
237     False
238     False
239     False
240     False
241     False
242     False
243     False
244     False
245     False
246     False
247     False
248     False
249     False
250     False
251     False
252     False
253     False
254     False
255     False
256     False
257     False
258     False
259     False
260     False
261     False
262     False
263     False
264     False
265     False
266     False
267     False
268     False
269     False
270     False
271     False
272     False
273     False
274     False
275     False
276     False
277     False
278     False
279     False
280     False
281     False
282     False
283     False
284     False
285     False
286     False
287     False
288     False
289     False
290     False
291     False
292     False
293     False
294     False
295     False
296     False
297     False
298     False
299     False
300     False
301     False
302     False
303     False
304     False
305     False
306     False
307     False
308     False
309     False
310     False
311     False
312     False
313     False
314     False
315     False
316     False
317     False
318     False
319     False
320     False
321     False
322     False
323     False
324     False
325     False
326     False
327     False
328     False
329     False
330     False
331     False
332     False
333     False
334     False
335     False
336     False
337     False
338     False
339     False
340     False
341     False
342     False
343     False
344     False
345     False
346     False
347     False
348     False
349     False
350     False
351     False
352     False
353     False
354     False
355     False
356     False
357     False
358     False
359     False
360     False
361     False
362     False
363     False
364     False
365     False
366     False
367     False
368     False
369     False
370     False
371     False
372     False
373     False
374     False
375     False
376     False
377     False
378     False
379     False
380     False
381     False
382     False
383     False
384     False
385     False
386     False
387     False
388     False
389     False
390     False
391     False
392     False
393     False
394     False
395     False
396     False
397     False
398     False
399     False
400     False
401     False
402     False
403     False
404     False
405     False
406     False
407     False
408     False
409     False
410     False
411     False
412     False
413     False
414     False
415     False
416     False
417     False
418     False
419     False
420     False
421     False
422     False
423     False
424     False
425     False
426     False
427     False
428     False
429     False
430     False
431     False
432     False
433     False
434     False
435     False
436     False
437     False
438     False
439     False
440     False
441     False
442     False
443     False
444     False
445     False
446     False
447     False
448     False
449     False
450     False
451     False
452     False
453     False
454     False
455     False
456     False
457     False
458     False
459     False
460     False
461     False
462     False
463     False
464     False
465     False
466     False
467     False
468     False
469     False
470     False
471     False
472     False
473     False
474     False
475     False
476     False
477     False
478     False
479     False
480     False
481     False
482     False
483     False
484     False
485     False
486     False
487     False
488     False
489     False
490     False
491     False
492     False
493     False
494     False
495     False
496     False
497     False
498     False
499     False
500     False
501     False
502     False
503     False
504     False
505     False
506     False
507     False
508     False
509     False
510     False
511     False
512     False
513     False
514     False
515     False
516     False
517     False
518     False
519     False
520     False
521     False
522     False
523     False
524     False
525     False
526     False
527     False
528     False
529     False
530     False
531     False
532     False
533     False
534     False
535     False
536     False
537     False
538     False
539     False
540     False
541     False
542     False
543     False
544     False
545     False
546     False
547     False
548     False
549     False
550     False
551     False
552     False
553     False
554     False
555     False
556     False
557     False
558     False
559     False
560     False
561     False
562     False
563     False
564     False
565     False
566     False
567     False
568     False
569     False
570     False
571     False
572     False
573     False
574     False
575     False
576     False
577     False
578     False
579     False
580     False
581     False
582     False
583     False
584     False
585     False
586     False
587     False
588     False
589     False
590     False
591     False
592     False
593     False
594     False
595     False
596     False
597     False
598     False
599     False
600     False
601     False
602     False
603     False
604     False
605     False
606     False
607     False
608     False
609     False
610     False
611     False
612     False
613     False
614     False
615     False
616     False
617     False
618     False
619     False
620     False
621     False
622     False
623     False
624     False
625     False
626     False
627     False
628     False
629     False
630     False
631     False
632     False
633     False
634     False
635     False
636     False
637     False
638     False
639     False
640     False
641     False
642     False
643     False
644     False
645     False
646     False
647     False
648     False
649     False
650     False
651     False
652     False
653     False
654     False
655     False
656     False
657     False
658     False
659     False
660     False
661     False
662     False
663     False
664     False
665     False
666     False
667     False
668     False
669     False
670     False
671     False
672     False
673     False
674     False
675     False
676     False
677     False
678     False
679     False
680     False
681     False
682     False
683     False
684     False
685     False
686     False
687     False
688     False
689     False
690     False
691     False
692     False
693     False
694     False
695     False
696     False
697     False
698     False
699     False
700     False
701     False
702     False
703     False
704     False
705     False
706     False
707     False
708     False
709     False
710     False
711     False
712     False
713     False
714     False
715     False
716     False
717     False
718     False
719     False
720     False
721     False
722     False
723     False
724     False
725     False
726     False
727     False
728     False
729     False
730     False
731     False
732     False
733     False
734     False
735     False
736     False
737     False
738     False
739     False
740     False
741     False
742     False
743     False
744     False
745     False
746     False
747     False
748     False
749     False
750     False
751     False
752     False
753     False
754     False
755     False
756     False
757     False
758     False
759     False
760     False
761     False
762     False
763     False
764     False
765     False
766     False
767     False
768     False
769     False
770     False
771     False
772     False
773     False
774     False
775     False
776     False
777     False
778     False
779     False
780     False
781     False
782     False
783     False
784     False
785     False
786     False
787     False
788     False
789     False
790     False
791     False
792     False
793     False
794     False
795     False
796     False
797     False
798     False
799     False
800     False
801     False
802     False
803     False
804     False
805     False
806     False
807     False
808     False
809     False
810     False
811     False
812     False
813     False
814     False
815     False
816     False
817     False
818     False
819     False
820     False
821     False
822     False
823     False
824     False
825     False
826     False
827     False
828     False
829     False
830     False
831     False
832     False
833     False
834     False
835     False
836     False
837     False
838     False
839     False
840     False
841     False
842     False
843     False
844     False
845     False
846     False
847     False
848     False
849     False
850     False
851     False
852     False
853     False
854     False
855     False
856     False
857     False
858     False
859     False
860     False
861     False
862     False
863     False
864     False
865     False
866     False
867     False
868     False
869     False
870     False
871     False
872     False
873     False
874     False
875     False
876     False
877     False
878     False
879     False
880     False
881     False
882     False
883     False
884     False
885     False
886     False
887     False
888     False
889     False
890     False
891     False
892     False
893     False
894     False
895     False
896     False
897     False
898     False
899     False
900     False
901     False
902     False
903     False
904     False
905     False
906     False
907     False
908     False
909     False
910     False
911     False
912     False
913     False
914     False
915     False
916     False
917     False
918     False
919     False
920     False
921     False
922     False
923     False
924     False
925     False
926     False
927     False
928     False
929     False
930     False
931     False
932     False
933     False
934     False
935     False
936     False
937     False
938     False
939     False
940     False
941     False
942     False
943     False
944     False
945     False
946     False
947     False
948     False
949     False
950     False
951     False
952     False
953     False
954     False
955     False
956     False
957     False
958     False
959     False
960     False
961     False
962     False
963     False
964     False
965     False
966     False
967     False
968     False
969     False
970     False
971     False
972     False
973     False
974     False
975     False
976     False
977     False
978     False
979     False
980     False
981     False
982     False
983     False
984     False
985     False
986     False
987     False
988     False
989     False
990     False
991     False
992     False
993     False
994     False
995     False
996     False
997     False
998     False
999     False
1000    False
1001    False
1002    False
1003    False
1004    False
1005    False
1006    False
1007    False
1008    False
1009    False
1010    False
1011    False
1012    False
1013    False
1014    False
1015    False
1016    False
1017    False
1018    False
1019    False
1020    False
1021    False
1022    False
1023    False
1024    False
1025    False
1026    False
1027    False
1028    False
1029    False
1030    False
1031    False
1032    False
1033    False
1034    False
1035    False
1036    False
1037    False
1038    False
1039    False
1040    False
1041    False
1042    False
1043    False
1044    False
1045    False
1046    False
1047    False
1048    False
1049    False
1050    False
1051    False
1052    False
1053    False
1054    False
1055    False
1056    False
1057    False
1058    False
1059    False
1060    False
1061    False
1062    False
1063    False
1064    False
1065    False
1066    False
1067    False
1068    False
1069    False
1070    False
1071    False
1072    False
1073    False
1074    False
1075    False
1076    False
1077    False
1078    False
1079    False
1080    False
1081    False
1082    False
1083    False
1084    False
1085    False
1086    False
1087    False
1088    False
1089    False
1090    False
1091    False
1092    False
1093    False
1094    False
1095    False
1096    False
1097    False
1098    False
1099    False
1100    False
1101    False
1102    False
1103    False
1104    False
1105    False
1106    False
1107    False
1108    False
1109    False
1110    False
1111    False
1112    False
1113    False
1114    False
1115    False
1116    False
1117    False
1118    False
1119    False
1120    False
1121    False
1122    False
1123    False
1124    False
1125    False
1126    False
1127    False
1128    False
1129    False
1130    False
1131    False
1132    False
1133    False
1134    False
1135    False
1136    False
1137    False
1138    False
1139    False
1140    False
1141    False
1142    False
1143    False
1144    False
1145    False
1146    False
1147    False
1148    False
1149    False
1150    False
1151    False
1152    False
1153    False
1154    False
1155    False
1156    False
1157    False
1158    False
1159    False
1160    False
1161    False
1162    False
1163    False
1164    False
1165    False
1166    False
1167    False
1168    False
1169    False
1170    False
1171    False
1172    False
1173    False
1174    False
1175    False
1176    False
1177    False
1178    False
1179    False
1180    False
1181    False
1182    False
1183    False
1184    False
1185    False
1186    False
1187    False
1188    False
1189    False
1190    False
1191    False
1192    False
1193    False
1194    False
1195    False
1196    False
1197    False
1198    False
1199    False
1200    False
1201    False
1202    False
1203    False
1204    False
1205    False
1206    False
1207    False
1208    False
1209    False
1210    False
1211    False
1212    False
1213    False
1214    False
1215    False
1216    False
1217    False
1218    False
1219    False
1220    False
1221    False
1222    False
1223    False
1224    False
1225    False
1226    False
1227    False
1228    False
1229    False
1230    False
1231    False
1232    False
1233    False
1234    False
1235    False
1236    False
1237    False
1238    False
1239    False
1240    False
1241    False
1242    False
1243    False
1244    False
1245    False
1246    False
1247    False
1248    False
1249    False
1250    False
1251    False
1252    False
1253    False
1254    False
1255    False
1256    False
1257    False
1258    False
1259    False
1260    False
1261    False
1262    False
1263    False
1264    False
1265    False
1266    False
1267    False
1268    False
1269    False
1270    False
1271    False
1272    False
1273    False
1274    False
1275    False
1276    False
1277    False
1278    False
1279    False
1280    False
1281    False
1282    False
1283    False
1284    False
1285    False
1286    False
1287    False
1288    False
1289    False
1290    False
1291    False
1292    False
1293    False
1294    False
1295    False
1296    False
1297    False
1298    False
1299    False
1300    False
1301    False
1302    False
1303    False
1304    False
1305    False
1306    False
1307    False
1308    False
1309    False
1310    False
1311    False
1312    False
1313    False
1314    False
1315    False
1316    False
1317    False
1318    False
1319    False
1320    False
1321    False
1322    False
1323    False
1324    False
1325    False
1326    False
1327    False
1328    False
1329    False
1330    False
1331    False
1332    False
1333    False
1334    False
1335    False
1336    False
1337    False
1338    False
1339    False
1340    False
1341    False
1342    False
1343    False
1344    False
1345    False
1346    False
1347    False
1348    False
1349    False
1350    False
1351    False
1352    False
1353    False
1354    False
1355    False
1356    False
1357    False
1358    False
1359    False
1360    False
1361    False
1362    False
1363    False
1364    False
1365    False
1366    False
1367    False
1368    False
1369    False
1370    False
1371    False
1372    False
1373    False
1374    False
1375    False
1376    False
1377    False
1378    False
1379    False
1380    False
1381    False
1382    False
1383    False
1384    False
1385    False
1386    False
1387    False
1388    False
1389    False
1390    False
1391    False
1392    False
1393    False
1394    False
1395    False
1396    False
1397    False
1398    False
1399    False
1400    False
1401    False
1402    False
1403    False
1404    False
1405    False
1406    False
1407    False
1408    False
1409    False
1410    False
1411    False
1412    False
1413    False
1414    False
1415    False
1416    False
1417    False
1418    False
1419    False
1420    False
1421    False
1422    False
1423    False
1424    False
1425    False
1426    False
1427    False
1428    False
1429    False
1430    False
1431    False
1432    False
1433    False
1434    False
1435    False
1436    False
1437    False
1438    False
1439    False
1440    False
1441    False
1442    False
1443    False
1444    False
1445    False
1446    False
1447    False
1448    False
1449    False
1450    False
1451    False
1452    False
1453    False
1454    False
1455    False
1456    False
1457    False
1458    False
1459    False
1460    False
1461    False
1462    False
1463    False
1464    False
1465    False
1466    False
1467    False
1468    False
1469    False
1470    False
1471    False
1472    False
1473    False
1474    False
1475    False
1476    False
1477    False
1478    False
1479    False
1480    False
1481    False
1482    False
1483    False
1484    False
1485    False
1486    False
1487    False
1488    False
1489    False
1490    False
1491    False
1492    False
1493    False
1494    False
1495    False
1496    False
1497    False
1498    False
1499    False
1500    False
1501    False
1502    False
1503    False
1504    False
1505    False
1506    False
1507    False
1508    False
1509    False
1510    False
1511    False
1512    False
1513    False
1514    False
1515    False
1516    False
1517    False
1518    False
1519    False
1520    False
1521    False
1522    False
1523    False
1524    False
1525    False
1526    False
1527    False
1528    False
1529    False
1530    False
1531    False
1532    False
1533    False
1534    False
1535    False
1536    False
1537    False
1538    False
1539    False
1540    False
1541    False
1542    False
1543    False
1544    False
1545    False
1546    False
1547    False
1548    False
1549    False
1550    False
1551    False
1552    False
1553    False
1554    False
1555    False
1556    False
1557    False
1558    False
1559    False
1560    False
1561    False
1562    False
1563    False
1564    False
1565    False
1566    False
1567    False
1568    False
1569    False
1570    False
1571    False
1572    False
1573    False
1574    False
1575    False
1576    False
1577    False
1578    False
1579    False
1580    False
1581    False
1582    False
1583    False
1584    False
1585    False
1586    False
1587    False
1588    False
1589    False
1590    False
1591    False
1592    False
1593    False
1594    False
1595    False
1596    False
1597    False
1598    False
1599    False
1600    False
1601    False
1602    False
1603    False
1604    False
1605    False
1606    False
1607    False
1608    False
1609    False
1610    False
1611    False
1612    False
1613    False
1614    False
1615    False
1616    False
1617    False
1618    False
1619    False
1620    False
1621    False
1622    False
1623    False
1624    False
1625    False
1626    False
1627    False
1628    False
1629    False
1630    False
1631    False
1632    False
1633    False
1634    False
1635    False
1636    False
1637    False
1638    False
1639    False
1640    False
1641    False
1642    False
1643    False
1644    False
1645    False
1646    False
1647    False
1648    False
1649    False
1650    False
1651    False
1652    False
1653    False
1654    False
1655    False
1656    False
1657    False
1658    False
1659    False
1660    False
1661    False
1662    False
1663    False
1664    False
1665    False
1666    False
1667    False
1668    False
1669    False
1670    False
1671    False
1672    False
1673    False
1674    False
1675    False
1676    False
1677    False
1678    False
1679    False
1680    False
1681    False
1682    False
1683    False
1684    False
1685    False
1686    False
1687    False
1688    False
1689    False
1690    False
1691    False
1692    False
1693    False
1694    False
1695    False
1696    False
1697    False
1698    False
1699    False
1700    False
1701    False
1702    False
1703    False
1704    False
1705    False
1706    False
1707    False
1708    False
1709    False
1710    False
1711    False
1712    False
1713    False
1714    False
1715    False
1716    False
1717    False
1718    False
1719    False
1720    False
1721    False
1722    False
1723    False
1724    False
1725    False
1726    False
1727    False
1728    False
1729    False
1730    False
1731    False
1732    False
1733    False
1734    False
1735    False
1736    False
1737    False
1738    False
1739    False
1740    False
1741    False
1742    False
1743    False
1744    False
1745    False
1746    False
1747    False
1748    False
1749    False
1750    False
1751    False
1752    False
1753    False
1754    False
1755    False
1756    False
1757    False
1758    False
1759    False
1760    False
1761    False
1762    False
1763    False
1764    False
1765    False
1766    False
1767    False
1768    False
1769    False
1770    False
1771    False
1772    False
1773    False
1774    False
1775    False
1776    False
1777    False
1778    False
1779    False
1780    False
1781    False
1782    False
1783    False
1784    False
1785    False
1786    False
1787    False
1788    False
1789    False
1790    False
1791    False
1792    False
1793    False
1794    False
1795    False
1796    False
1797    False
1798    False
1799    False
1800    False
1801    False
1802    False
1803    False
1804    False
1805    False
1806    False
1807    False
1808    False
1809    False
1810    False
1811    False
1812    False
1813    False
1814    False
1815    False
1816    False
1817    False
1818    False
1819    False
1820    False
1821    False
1822    False
1823    False
1824    False
1825    False
1826    False
1827    False
1828    False
1829    False
1830    False
1831    False
1832    False
1833    False
1834    False
1835    False
1836    False
1837    False
1838    False
1839    False
1840    False
1841    False
1842    False
1843    False
1844    False
1845    False
1846    False
1847    False
1848    False
1849    False
1850    False
1851    False
1852    False
1853    False
1854    False
1855    False
1856    False
1857    False
1858    False
1859    False
1860    False
1861    False
1862    False
1863    False
1864    False
1865    False
1866    False
1867    False
1868    False
1869    False
1870    False
1871    False
1872    False
1873    False
1874    False
1875    False
1876    False
1877    False
1878    False
1879    False
1880    False
1881    False
1882    False
1883    False
1884    False
1885    False
1886    False
1887    False
1888    False
1889    False
1890    False
1891    False
1892    False
1893    False
1894    False
1895    False
1896    False
1897    False
1898    False
1899    False
1900    False
1901    False
1902    False
1903    False
1904    False
1905    False
1906    False
1907    False
1908    False
1909    False
1910    False
1911    False
1912    False
1913    False
1914    False
1915    False
1916    False
1917    False
1918    False
1919    False
1920    False
1921    False
1922    False
1923    False
1924    False
1925    False
1926    False
1927    False
1928    False
1929    False
1930    False
1931    False
1932    False
1933    False
1934    False
1935    False
1936    False
1937    False
1938    False
1939    False
1940    False
1941    False
1942    False
1943    False
1944    False
1945    False
1946    False
1947    False
1948    False
1949    False
1950    False
1951    False
1952    False
1953    False
1954    False
1955    False
1956    False
1957    False
1958    False
1959    False
1960    False
1961    False
1962    False
1963    False
1964    False
1965    False
1966    False
1967    False
1968    False
1969    False
1970    False
1971    False
1972    False
1973    False
1974    False
1975    False
1976    False
1977    False
1978    False
1979    False
1980    False
1981    False
1982    False
1983    False
1984    False
1985    False
1986    False
1987    False
1988    False
1989    False
1990    False
1991    False
1992    False
1993    False
1994    False
1995    False
1996    False
1997    False
1998    False
1999    False
2000    False
2001    False
2002    False
2003    False
2004    False
2005    False
2006    False
2007    False
2008    False
2009    False
2010    False
2011    False
2012    False
2013    False
2014    False
2015    False
2016    False
2017    False
2018    False
2019    False
2020    False
2021    False
2022    False
2023    False
2024    False
2025    False
2026    False
2027    False
2028    False
2029    False
2030    False
2031    False
2032    False
2033    False
2034    False
2035    False
2036    False
2037    False
2038    False
2039    False
2040    False
2041    False
2042    False
2043    False
2044    False
2045    False
2046    False
2047    False
2048    False
2049    False
2050    False
2051    False
2052    False
2053    False
2054    False
2055    False
2056    False
2057    False
2058    False
2059    False
2060    False
2061    False
2062    False
2063    False
2064    False
2065    False
2066    False
2067    False
2068    False
2069    False
2070    False
2071    False
2072    False
2073    False
2074    False
2075    False
2076    False
2077    False
2078    False
2079    False
2080    False
2081    False
2082    False
2083    False
2084    False
2085    False
2086    False
2087    False
2088    False
2089    False
2090    False
2091    False
2092    False
2093    False
2094    False
2095    False
2096    False
2097    False
2098    False
2099    False
2100    False
2101    False
2102    False
2103    False
2104    False
2105    False
2106    False
2107    False
2108    False
2109    False
2110    False
2111    False
2112    False
2113    False
2114    False
2115    False
2116    False
2117    False
2118    False
2119    False
2120    False
2121    False
2122    False
2123    False
2124    False
2125    False
2126    False
2127    False
2128    False
2129    False
2130    False
2131    False
2132    False
2133    False
2134    False
2135    False
2136    False
2137    False
2138    False
2139    False
2140    False
2141    False
2142    False
2143    False
2144    False
2145    False
2146    False
2147    False
2148    False
2149    False
2150    False
2151    False
2152    False
2153    False
2154    False
2155    False
2156    False
2157    False
2158    False
2159    False
2160    False
2161    False
2162    False
2163    False
2164    False
2165    False
2166    False
2167    False
2168    False
2169    False
2170    False
2171    False
2172    False
2173    False
2174    False
2175    False
2176    False
2177    False
2178    False
2179    False
2180    False
2181    False
2182    False
2183    False
2184    False
2185    False
2186    False
2187    False
2188    False
2189    False
2190    False
2191    False
2192    False
2193    False
2194    False
2195    False
2196    False
2197    False
2198    False
2199    False
2200    False
2201    False
2202    False
2203    False
2204    False
2205    False
2206    False
2207    False
2208    False
2209    False
2210    False
2211    False
2212    False
2213    False
2214    False
2215    False
2216    False
2217    False
2218    False
2219    False
2220    False
2221    False
2222    False
2223    False
2224    False
2225    False
2226    False
2227    False
2228    False
2229    False
2230    False
2231    False
2232    False
2233    False
2234    False
2235    False
2236    False
2237    False
2238    False
2239    False
2240    False
2241    False
2242    False
2243    False
2244    False
2245    False
2246    False
2247    False
2248    False
2249    False
2250    False
2251    False
2252    False
2253    False
2254    False
2255    False
2256    False
2257    False
2258    False
2259    False
2260    False
2261    False
2262    False
2263    False
2264    False
2265    False
2266    False
2267    False
2268    False
2269    False
2270    False
2271    False
2272    False
2273    False
2274    False
2275    False
2276    False
2277    False
2278    False
2279    False
2280    False
2281    False
2282    False
2283    False
2284    False
2285    False
2286    False
2287    False
2288    False
2289    False
2290    False
2291    False
2292    False
2293    False
2294    False
2295    False
2296    False
2297    False
2298    False
2299    False
2300    False
2301    False
2302    False
2303    False
2304    False
2305    False
2306    False
2307    False
2308    False
2309    False
2310    False
2311    False
2312    False
2313    False
2314    False
2315    False
2316    False
2317    False
2318    False
2319    False
2320    False
2321    False
2322    False
2323    False
2324    False
2325    False
2326    False
2327    False
2328    False
2329    False
2330    False
2331    False
2332    False
2333    False
2334    False
2335    False
2336    False
2337    False
2338    False
2339    False
2340    False
2341    False
2342    False
2343    False
2344    False
2345    False
2346    False
2347    False
2348    False
2349    False
2350    False
2351    False
2352    False
2353    False
2354    False
2355    False
2356    False
2357    False
2358    False
2359    False
2360    False
2361    False
2362    False
2363    False
2364    False
2365    False
2366    False
2367    False
2368    False
2369    False
2370    False
2371    False
2372    False
2373    False
2374    False
2375    False
2376    False
2377    False
2378    False
2379    False
2380    False
2381    False
2382    False
2383    False
2384    False
2385    False
2386    False
2387    False
2388    False
2389    False
2390    False
2391    False
2392    False
2393    False
2394    False
2395    False
2396    False
2397    False
2398    False
2399    False
2400    False
2401    False
2402    False
2403    False
2404    False
2405    False
2406    False
2407    False
2408    False
2409    False
2410    False
2411    False
2412    False
2413    False
2414    False
2415    False
2416    False
2417    False
2418    False
2419    False
2420    False
2421    False
2422    False
2423    False
2424    False
2425    False
2426    False
2427    False
2428    False
2429    False
2430    False
2431    False
2432    False
2433    False
2434    False
2435    False
2436    False
2437    False
2438    False
2439    False
2440    False
2441    False
2442    False
2443    False
2444    False
2445    False
2446    False
2447    False
2448    False
2449    False
2450    False
2451    False
2452    False
2453    False
2454    False
2455    False
2456    False
2457    False
2458    False
2459    False
2460    False
2461    False
2462    False
2463    False
2464    False
2465    False
2466    False
2467    False
2468    False
2469    False
2470    False
2471    False
2472    False
2473    False
2474    False
2475    False
2476    False
2477    False
2478    False
2479    False
2480    False
2481    False
2482    False
2483    False
2484    False
2485    False
2486    False
2487    False
2488    False
2489    False
2490    False
2491    False
2492    False
2493    False
2494    False
2495    False
2496    False
2497    False
2498    False
2499    False
2500    False
2501    False
2502    False
2503    False
2504    False
2505    False
2506    False
2507    False
2508    False
2509    False
2510    False
2511    False
2512    False
2513    False
2514    False
2515    False
2516    False
2517    False
2518    False
2519    False
2520    False
2521    False
2522    False
2523    False
2524    False
2525    False
2526    False
2527    False
2528    False
2529    False
2530    False
2531    False
2532    False
2533    False
2534    False
2535    False
2536    False
2537    False
2538    False
2539    False
2540    False
2541    False
2542    False
2543    False
2544    False
2545    False
2546    False
2547    False
2548    False
2549    False
2550    False
2551    False
2552    False
2553    False
2554    False
2555    False
2556    False
2557    False
2558    False
2559    False
2560    False
2561    False
2562    False
2563    False
2564    False
2565    False
2566    False
2567    False
2568    False
2569    False
2570    False
2571    False
2572    False
2573    False
2574    False
2575    False
2576    False
2577    False
2578    False
2579    False
2580    False
2581    False
2582    False
2583    False
2584    False
2585    False
2586    False
2587    False
2588    False
2589    False
2590    False
2591    False
2592    False
2593    False
2594    False
2595    False
2596    False
2597    False
2598    False
2599    False
2600    False
2601    False
2602    False
2603    False
2604    False
2605    False
2606    False
2607    False
2608    False
2609    False
2610    False
2611    False
2612    False
2613    False
2614    False
2615    False
2616    False
2617    False
2618    False
2619    False
2620    False
2621    False
2622    False
2623    False
2624    False
2625    False
2626    False
2627    False
2628    False
2629    False
2630    False
2631    False
2632    False
2633    False
2634    False
2635    False
2636    False
2637    False
2638    False
2639    False
2640    False
2641    False
2642    False
2643    False
2644    False
2645    False
2646    False
2647    False
2648    False
2649    False
2650    False
2651    False
2652    False
2653    False
2654    False
2655    False
2656    False
2657    False
2658    False
2659    False
2660    False
2661    False
2662    False
2663    False
2664    False
2665    False
2666    False
2667    False
2668    False
2669    False
2670    False
2671    False
2672    False
2673    False
2674    False
2675    False
2676    False
2677    False
2678    False
2679    False
2680    False
2681    False
2682    False
2683    False
2684    False
2685    False
2686    False
2687    False
2688    False
2689    False
2690    False
2691    False
2692    False
2693    False
2694    False
2695    False
2696    False
2697    False
2698    False
2699    False
2700    False
2701    False
2702    False
2703    False
2704    False
2705    False
2706    False
2707    False
2708    False
2709    False
2710    False
2711    False
2712    False
2713    False
2714    False
2715    False
2716    False
2717    False
2718    False
2719    False
2720    False
2721    False
2722    False
2723    False
2724    False
2725    False
2726    False
2727    False
2728    False
2729    False
2730    False
2731    False
2732    False
2733    False
2734    False
2735    False
2736    False
2737    False
2738    False
2739     True
2740    False
2741    False
2742    False
2743    False
2744    False
2745    False
2746    False
2747    False
2748    False
2749    False
2750    False
2751    False
2752    False
2753    False
2754    False
2755    False
2756    False
2757    False
2758    False
2759    False
2760    False
2761    False
2762    False
2763    False
2764    False
2765    False
2766    False
2767    False
2768    False
2769    False
2770    False
2771    False
2772    False
2773    False
2774    False
2775    False
2776    False
2777    False
2778    False
2779    False
2780    False
2781    False
2782    False
2783    False
2784    False
2785    False
2786    False
2787    False
2788    False
2789    False
2790    False
2791    False
2792    False
2793    False
2794    False
2795    False
2796    False
2797    False
2798    False
2799    False
2800    False
2801    False
2802    False
2803    False
2804    False
2805    False
2806    False
2807    False
2808    False
2809    False
2810    False
2811    False
2812    False
2813    False
2814    False
2815    False
2816    False
2817    False
2818    False
2819    False
2820    False
2821    False
2822    False
2823    False
2824    False
2825    False
2826    False
2827    False
2828    False
2829    False
2830    False
2831    False
2832    False
2833    False
2834    False
2835    False
2836    False
2837    False
2838    False
2839    False
2840    False
2841    False
2842    False
2843    False
2844    False
2845    False
2846    False
2847    False
2848    False
2849    False
2850    False
2851    False
2852    False
2853    False
2854    False
2855    False
2856    False
2857    False
2858    False
2859    False
2860    False
2861    False
2862    False
2863    False
2864    False
2865    False
2866    False
2867    False
2868    False
2869    False
2870    False
2871    False
2872    False
2873    False
2874    False
2875    False
2876    False
2877    False
2878    False
2879    False
2880    False
2881    False
2882    False
2883    False
2884    False
2885    False
2886    False
2887    False
2888    False
2889    False
2890    False
2891    False
2892    False
2893    False
2894    False
2895    False
2896    False
2897    False
2898    False
2899    False
2900    False
2901    False
2902    False
2903    False
2904    False
2905    False
2906    False
2907    False
2908    False
2909    False
2910    False
2911    False
2912    False
2913    False
2914    False
2915    False
2916    False
2917    False
2918    False
2919    False
2920    False
2921    False
2922    False
2923    False
2924    False
2925    False
2926    False
2927    False
2928    False
2929    False
2930    False
2931    False
2932    False
2933    False
2934    False
2935    False
2936    False
2937    False
2938    False
2939    False
2940    False
2941    False
2942    False
2943    False
2944    False
2945    False
2946    False
2947    False
2948    False
2949    False
2950    False
2951    False
2952    False
2953    False
2954    False
2955    False
2956    False
2957    False
2958    False
2959    False
2960    False
2961    False
2962    False
2963    False
2964    False
2965     True
2966    False
2967    False
2968    False
2969    False
2970    False
2971    False
2972    False
2973    False
2974    False
2975    False
2976    False
2977    False
2978    False
2979    False
2980    False
2981    False
2982    False
2983    False
2984    False
2985    False
2986    False
2987    False
2988    False
2989    False
2990    False
2991    False
2992    False
2993    False
2994    False
2995    False
2996    False
2997    False
2998    False
2999    False
3000    False
3001    False
3002    False
3003    False
3004    False
3005    False
3006    False
3007    False
3008    False
3009    False
3010    False
3011    False
3012    False
3013    False
3014    False
3015    False
3016    False
3017    False
3018    False
3019    False
3020    False
3021    False
3022    False
3023    False
3024    False
3025    False
3026    False
3027    False
3028    False
3029    False
3030    False
3031    False
3032    False
dtype: bool
In [59]:
# Eliminar las filas 2739 y 2965 del DataFrame
infoairports.drop([2739, 2965], inplace=True)
In [60]:
# Con los cambios realizados realizamos el plot, no proyectado, es decir en grados
base = canada.plot(color='white', edgecolor='black')

infoairports.plot.scatter(x = 'longitude_deg', y = 'latitude_deg',ax=base)
Out[60]:
<Axes: xlabel='longitude_deg', ylabel='latitude_deg'>
In [65]:
#Convertimos en GeoDataFrame
airports=gpd.GeoDataFrame(data=infoairports.copy(),
                 geometry=gpd.points_from_xy(infoairports.longitude_deg,
                                             infoairports.latitude_deg), 
                 crs=canada.crs.to_epsg())
In [66]:
#ploteamos el mapa
base = canada.plot(color='white', edgecolor='black')
airports.plot(ax=base)
Out[66]:
<Axes: >
In [67]:
#verificamos que se haya convertido en GDF
type(airports), type(infoairports)
Out[67]:
(geopandas.geodataframe.GeoDataFrame, pandas.core.frame.DataFrame)
In [68]:
#proyectamos con el valor correcto de crs (EPSG)
airports.to_crs(3347).plot()
Out[68]:
<Axes: >
In [69]:
#guardamos el mapa proyectado
airports_3347=airports.to_crs(3347)
In [70]:
#vemos que tipos de aeropuertos tenemos
airports_3347['type'].value_counts()
Out[70]:
type
small_airport     1071
closed             745
heliport           471
seaplane_base      399
medium_airport     329
large_airport       13
balloonport          1
Name: count, dtype: int64
In [71]:
#renombramos las columnas de type
airports_3347.rename(columns={'type':'kind'},inplace=True)
In [73]:
from folium import LayerControl


m = airports_3347[airports_3347.kind=='small_airport'].explore(color="deeppink",name="small",show=False)
m = airports_3347[airports_3347.kind=='medium_airport'].explore(m=m, color="dodgerblue",name="medium",show=False)
m = airports_3347[airports_3347.kind=='large_airport'].explore(m=m, color="gray",name="large",show=True)
m = airports_3347[airports_3347.kind=='seaplane_base'].explore(m=m, color="greenyellow",name="seaplane",show=False)
m = airports_3347[airports_3347.kind=='closed'].explore(m=m, color="yellow",name="closed",show=False)
m = airports_3347[airports_3347.kind=='heliport'].explore(m=m, color="orange",name="heliport",show=False)

LayerControl(collapsed=False).add_to(m)

m
Out[73]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [74]:
#exportamos el mapa proyectado como gpkg
airports_3347.to_file(os.path.join("maps","airports_3347.gpkg"),layer='airports', driver="GPKG")
In [75]:
#Ejercicio 6
In [77]:
#creamos un convex hull de Canadá
canada.convex_hull.plot()
Out[77]:
<Axes: >
In [78]:
medium_airport=airports_3347[airports_3347.kind=='medium_airport']
#filas que cumplen con la condición de aeropuertos medianos 
medium_airport
Out[78]:
name kind latitude_deg longitude_deg elevation_ft region_name municipality geometry
5 Billy Bishop Toronto City Centre Airport medium_airport 43.627499 -79.396202 252.0 Ontario Toronto POINT (7224333.646 925621.026)
11 London Airport medium_airport 43.035599 -81.153900 912.0 Ontario London POINT (7092745.018 832780.612)
12 John C. Munro Hamilton International Airport medium_airport 43.173599 -79.934998 780.0 Ontario Hamilton POINT (7190253.037 866321.421)
13 Regina International Airport medium_airport 50.431900 -104.666000 1894.0 Saskatchewan Regina POINT (5301503.877 1678527.853)
14 Kelowna International Airport medium_airport 49.956100 -119.377998 1421.0 British Columbia Kelowna POINT (4293620.839 1953961.073)
15 Saskatoon John G. Diefenbaker International Ai... medium_airport 52.170799 -106.699997 1653.0 Saskatchewan Saskatoon POINT (5205474.979 1896176.231)
16 Kingston Norman Rogers Airport medium_airport 44.225300 -76.596901 305.0 Ontario Kingston POINT (7434098.649 1041668.707)
17 Waterloo Airport medium_airport 43.460800 -80.378601 1055.0 Ontario Kitchener POINT (7147965.452 891745.232)
18 Montreal International (Mirabel) Airport medium_airport 45.679501 -74.038696 270.0 Quebec Montréal POINT (7590315.895 1253414.497)
19 Thunder Bay Airport medium_airport 48.371899 -89.323898 653.0 Ontario Thunder Bay POINT (6388804.328 1362829.160)
20 Buttonville Municipal Airport medium_airport 43.862202 -79.370003 650.0 Ontario Toronto POINT (7221246.708 952225.461)
22 Muskoka Airport medium_airport 44.974701 -79.303299 925.0 Ontario Muskoka POINT (7201875.179 1076978.996)
24 Gander International Airport / CFB Gander medium_airport 48.936258 -54.567719 496.0 Newfoundland and Labrador Gander POINT (8779404.434 2200630.278)
25 Peterborough Municipal Airport medium_airport 44.230000 -78.363297 628.0 Ontario Peterborough POINT (7293521.729 1009866.544)
26 Oshawa Executive Airport medium_airport 43.922798 -78.894997 460.0 Ontario Oshawa POINT (7258140.382 966739.794)
27 Greater Moncton Roméo LeBlanc International Ai... medium_airport 46.112202 -64.678596 232.0 New Brunswick Moncton POINT (8263258.405 1553816.416)
28 Montréal / Saint-Hubert Airport medium_airport 45.517502 -73.416901 90.0 Quebec Montréal POINT (7642687.632 1249731.768)
29 Niagara District Airport medium_airport 43.191700 -79.171700 321.0 Ontario Niagara-on-the-Lake POINT (7252375.041 880603.867)
31 Fredericton Airport medium_airport 45.868900 -66.537201 68.0 New Brunswick Fredericton POINT (8140667.346 1470224.185)
32 Ottawa / Rockcliffe Airport medium_airport 45.460300 -75.646103 188.0 Ontario Ottawa POINT (7474067.191 1195903.989)
36 Boundary Bay Airport medium_airport 49.074200 -123.012001 6.0 British Columbia Delta POINT (4014904.542 1983166.520)
37 Nanaimo Airport medium_airport 49.054970 -123.869863 92.0 British Columbia Nanaimo POINT (3958776.972 2011136.024)
38 Whitehorse / Erik Nielsen International Airport medium_airport 60.709599 -135.067001 2317.0 Yukon Whitehorse POINT (4081177.841 3458631.279)
39 Kamloops John Moose Fulton Field Regional Airport medium_airport 50.702202 -120.444000 1133.0 British Columbia Kamloops POINT (4260556.222 2060877.068)
40 Sudbury Airport medium_airport 46.625000 -80.798897 1141.0 Ontario Sudbury POINT (7051706.370 1237932.836)
41 Ottawa / Gatineau Airport medium_airport 45.521702 -75.563599 211.0 Quebec Gatineau POINT (7478649.248 1204261.607)
42 Charlottetown Airport medium_airport 46.290001 -63.121101 160.0 Prince Edward Island Charlottetown POINT (8364804.477 1623679.935)
43 Calgary / Springbank Airport medium_airport 51.103100 -114.374001 3940.0 Alberta Calgary POINT (4667996.367 1935921.592)
45 Goose Bay Airport medium_airport 53.319199 -60.425800 160.0 Newfoundland and Labrador Goose Bay POINT (8181807.067 2405873.251)
46 Goderich Airport medium_airport 43.766899 -81.710602 712.0 Ontario Goderich POINT (7033510.925 907428.796)
47 Wiarton Airport medium_airport 44.745800 -81.107201 729.0 Ontario Wiarton POINT (7063873.506 1025053.433)
49 Sault Ste Marie Airport medium_airport 46.485001 -84.509399 630.0 Ontario Sault Ste Marie POINT (6769582.807 1180901.323)
50 Windsor Airport medium_airport 42.275600 -82.955597 622.0 Ontario Windsor POINT (6955821.325 723539.072)
51 Ottawa / Carp Airport medium_airport 45.319199 -76.022202 382.0 Ontario Ottawa POINT (7449073.405 1173021.496)
52 North Bay Jack Garland Airport medium_airport 46.363602 -79.422798 1215.0 Ontario North Bay POINT (7162031.747 1228691.053)
54 Cornwall Regional Airport medium_airport 45.092637 -74.567724 175.0 Ontario Cornwall POINT (7567892.048 1178212.578)
55 Iqaluit Airport medium_airport 63.756402 -68.555801 110.0 Nunavut Iqaluit POINT (7290652.864 3241648.136)
56 Penticton Airport medium_airport 49.463100 -119.601997 1129.0 British Columbia Penticton POINT (4255993.935 1911131.573)
57 Yellowknife International Airport medium_airport 62.462799 -114.440002 675.0 Northwest Territories Yellowknife POINT (5093783.523 3098090.517)
58 Sydney / J.A. Douglas McCurdy Airport medium_airport 46.161400 -60.047798 203.0 Nova Scotia Sydney POINT (8584602.915 1720752.274)
61 Lethbridge County Airport medium_airport 49.630299 -112.800003 3048.0 Alberta Lethbridge POINT (4718400.699 1745031.062)
62 Brandon Municipal Airport medium_airport 49.910000 -99.951897 1343.0 Manitoba Brandon POINT (5622789.365 1566757.061)
63 Fort McMurray Airport medium_airport 56.653301 -111.222000 1211.0 Alberta Fort McMurray POINT (5057490.269 2445219.518)
64 Grande Prairie Airport medium_airport 55.179699 -118.885002 2195.0 Alberta Grande Prairie POINT (4562352.510 2462554.667)
67 Red Deer Regional Airport medium_airport 52.182201 -113.893997 2968.0 Alberta Springbrook POINT (4739706.356 2036351.640)
69 Sherbrooke Airport medium_airport 45.438599 -71.691399 792.0 Quebec Sherbrooke POINT (7776038.015 1282184.415)
70 Saint John Airport medium_airport 45.316101 -65.890297 357.0 New Brunswick Saint John POINT (8212238.171 1432988.699)
71 Huronia Airport medium_airport 44.683300 -79.928299 770.0 Ontario Midland POINT (7158789.185 1034980.769)
72 Smiths Falls-Montague (Russ Beach) Airport medium_airport 44.945801 -75.940598 416.0 Ontario Smiths Falls POINT (7465826.619 1133749.331)
73 St Thomas Municipal Airport medium_airport 42.770000 -81.110802 778.0 Ontario St Thomas POINT (7101407.835 803483.260)
75 Chris Hadfield Airport medium_airport 42.999401 -82.308899 594.0 Ontario Sarnia POINT (6997881.236 813350.052)
76 Tofino / Long Beach Airport medium_airport 49.079833 -125.775583 80.0 British Columbia Tofino POINT (3839202.894 2082484.107)
77 Brampton-Caledon Airport medium_airport 43.760300 -79.875000 935.0 Ontario NaN POINT (7182649.679 932897.533)
78 Pembroke Airport medium_airport 45.864399 -77.251701 529.0 Ontario Pembroke POINT (7339930.815 1209661.030)
80 Deer Lake Airport medium_airport 49.210800 -57.391399 72.0 Newfoundland and Labrador Deer Lake POINT (8588816.811 2116133.336)
81 Campbell River Airport medium_airport 49.950802 -125.271004 346.0 British Columbia Campbell River POINT (3919485.241 2147532.748)
82 Comox Valley Airport / CFB Comox medium_airport 49.710800 -124.887001 84.0 British Columbia Comox POINT (3930084.437 2110731.954)
83 Timmins/Victor M. Power medium_airport 48.569698 -81.376701 967.0 Ontario Timmins POINT (6971957.460 1444896.372)
84 Kenora Airport medium_airport 49.788300 -94.363098 1332.0 Ontario Kenora POINT (6020813.473 1520045.735)
85 Cranbrook/Canadian Rockies International Airport medium_airport 49.610802 -115.781998 3082.0 British Columbia Cranbrook POINT (4515927.389 1817220.541)
86 Medicine Hat Regional Airport medium_airport 50.018902 -110.721001 2352.0 Alberta Medicine Hat POINT (4873547.434 1740138.451)
88 Bromont (Roland Désourdy) Airport medium_airport 45.290798 -72.741402 375.0 Quebec Bromont POINT (7701514.360 1240887.094)
89 Trois-Rivières Airport medium_airport 46.352798 -72.679398 199.0 Quebec Trois-Rivières POINT (7670689.144 1356588.904)
90 Hope Airport / FVRD Regional Airpark medium_airport 49.368865 -121.494950 128.0 British Columbia Hope POINT (4128010.894 1961475.994)
91 Winnipeg / St. Andrews Airport medium_airport 50.056400 -97.032501 760.0 Manitoba Saint Andrews POINT (5831934.761 1561200.160)
92 Wawa Airport medium_airport 47.966702 -84.786697 942.0 Ontario Wawa POINT (6729774.729 1343364.955)
96 Dryden Regional Airport medium_airport 49.831699 -92.744202 1354.0 Ontario Dryden POINT (6137065.304 1521775.395)
97 Powell River Airport medium_airport 49.834202 -124.500000 425.0 British Columbia Powell River POINT (3961013.154 2108917.895)
98 Rouyn Noranda Airport medium_airport 48.206100 -78.835602 988.0 Quebec Rouyn-Noranda POINT (7164839.145 1439748.092)
99 Gore Bay Manitoulin Airport medium_airport 45.885300 -82.567802 623.0 Ontario Gore Bay POINT (6928762.957 1133837.909)
100 Watson Lake Airport medium_airport 60.116402 -128.822006 2255.0 Yukon Watson Lake POINT (4313406.522 3209897.619)
102 CFB Bagotville medium_airport 48.330601 -70.996399 522.0 Quebec Bagotville POINT (7723880.579 1606724.012)
103 Fort St John Airport medium_airport 56.238098 -120.739998 2280.0 British Columbia Fort St.John POINT (4508082.805 2615572.418)
104 High Level Airport medium_airport 58.621399 -117.165001 1110.0 Alberta High Level POINT (4805881.680 2764821.035)
105 Owen Sound / Billy Bishop Regional Airport medium_airport 44.590302 -80.837502 1007.0 Ontario Owen Sound POINT (7088350.926 1011416.741)
107 Centralia / James T. Field Memorial Aerodrome medium_airport 43.285599 -81.508301 824.0 Ontario Huron Park POINT (7058853.566 856028.212)
108 St Jean Airport medium_airport 45.294399 -73.281097 136.0 Quebec St Jean POINT (7660257.182 1228710.772)
110 Churchill Airport medium_airport 58.739201 -94.065002 94.0 Manitoba Churchill POINT (6076068.406 2498783.091)
111 Lloydminster Airport medium_airport 53.309200 -110.072998 2193.0 Alberta Lloydminster POINT (5020253.316 2074749.397)
112 Smithers Airport medium_airport 54.824699 -127.182999 1712.0 British Columbia Smithers POINT (4084827.874 2673414.642)
113 Stephenville Airport medium_airport 48.544201 -58.549999 84.0 Newfoundland and Labrador Stephenville POINT (8553259.843 2009058.235)
115 Revelstoke Airport medium_airport 50.962245 -118.184258 1459.0 British Columbia Revelstoke POINT (4416203.487 2020836.880)
116 Fort Nelson Airport medium_airport 58.836399 -122.597000 1253.0 British Columbia Fort Nelson POINT (4538751.897 2916478.710)
117 Port Hardy Airport medium_airport 50.680599 -127.366997 71.0 British Columbia Port Hardy POINT (3833839.527 2293328.480)
118 CFB Trenton medium_airport 44.118900 -77.528099 283.0 Ontario Trenton POINT (7362860.687 1012370.777)
119 Golden Airport medium_airport 51.299196 -116.982002 2575.0 British Columbia Golden POINT (4507610.790 2022182.816)
128 Castlegar/West Kootenay Regional Airport medium_airport 49.296398 -117.632004 1624.0 British Columbia Castlegar POINT (4378824.647 1835917.962)
129 Sept-Îles Airport medium_airport 50.223301 -66.265602 180.0 Quebec Sept-Îles POINT (7969932.806 1925812.159)
130 Northwest Regional Airport Terrace-Kitimat medium_airport 54.468498 -128.576009 713.0 British Columbia Terrace POINT (3989421.477 2687923.027)
131 Val-d'Or Airport medium_airport 48.053299 -77.782799 1107.0 Quebec Val-d'Or POINT (7245305.264 1439720.524)
132 Summerside Airport medium_airport 46.440601 -63.833599 56.0 Prince Edward Island Slemon Park POINT (8307495.485 1615018.821)
135 Dawson City Airport medium_airport 64.043098 -139.128006 1215.0 Yukon Dawson City POINT (4161869.778 3864580.654)
136 Inuvik Mike Zubko Airport medium_airport 68.304199 -133.483002 224.0 Northwest Territories Inuvik POINT (4647099.765 4058475.858)
137 Mont Joli Airport medium_airport 48.608601 -68.208099 172.0 Quebec Mont-Joli POINT (7907328.844 1706664.829)
138 Prince Albert Glass Field medium_airport 53.214199 -105.672997 1405.0 Saskatchewan Prince Albert POINT (5297894.426 1992614.818)
139 Prince Rupert Airport medium_airport 54.286098 -130.445007 116.0 British Columbia Prince Rupert POINT (3879252.493 2737942.608)
140 Rankin Inlet Airport medium_airport 62.811401 -92.115799 94.0 Nunavut Rankin Inlet POINT (6187678.686 2937415.953)
141 Elliot Lake Municipal Airport medium_airport 46.351398 -82.561401 1087.0 Ontario Elliot Lake POINT (6921616.684 1185790.112)
142 Vernon Airport medium_airport 50.248100 -119.331001 1140.0 British Columbia Vernon POINT (4310208.784 1981930.471)
146 Kuujjuaq Airport medium_airport 58.096100 -68.426903 129.0 Quebec Kuujjuaq POINT (7517110.355 2672328.485)
147 Quesnel Airport medium_airport 53.026100 -122.510002 1789.0 British Columbia Quesnel POINT (4249554.634 2352814.896)
148 Thompson Airport medium_airport 55.801102 -97.864197 729.0 Manitoba Thompson POINT (5832246.095 2194555.686)
149 Wabush Airport medium_airport 52.921902 -66.864403 1808.0 Newfoundland and Labrador Wabush POINT (7816759.714 2184155.319)
150 CFB Cold Lake medium_airport 54.404999 -110.278999 1775.0 Alberta Cold Lake POINT (5041535.707 2193613.728)
151 Shuswap Regional Airport medium_airport 50.682802 -119.228996 1751.0 British Columbia Salmon Arm POINT (4336845.194 2022616.565)
152 Slave Lake Airport medium_airport 55.293098 -114.777000 1912.0 Alberta Slave Lake POINT (4803803.884 2375993.167)
157 Peace River Airport medium_airport 56.226898 -117.446999 1873.0 Alberta Peace River POINT (4689315.200 2531541.418)
158 Williams Lake Airport medium_airport 52.183102 -122.054001 3085.0 British Columbia Williams Lake POINT (4234011.175 2256522.773)
159 Yorkton Municipal Airport medium_airport 51.264702 -102.461998 1635.0 Saskatchewan Yorkton POINT (5469894.697 1740790.920)
160 Swift Current Airport medium_airport 50.291901 -107.691002 2680.0 Saskatchewan Swift Current POINT (5089306.574 1711205.627)
161 Princeton Airport medium_airport 49.468102 -120.511002 2298.0 British Columbia Town of Princeton POINT (4196812.605 1939838.596)
164 Chapais Airport medium_airport 49.771900 -74.528099 1270.0 Quebec Chibougamau POINT (7429961.556 1683395.461)
166 Portage-la-Prairie / Southport Airport medium_airport 49.903099 -98.273817 885.0 Manitoba Portage la Prairie POINT (5742052.934 1552341.251)
167 Marathon Airport medium_airport 48.755299 -86.344398 1035.0 Ontario Marathon POINT (6605927.575 1419394.803)
168 North Battleford Airport medium_airport 52.769409 -108.243742 1799.0 Saskatchewan North Battleford POINT (5120916.450 1985187.107)
169 Saint-Georges Airport medium_airport 46.096401 -70.714699 893.0 Quebec Saint-Georges POINT (7825373.652 1377010.238)
178 Dauphin Barker Airport medium_airport 51.100800 -100.052002 999.0 Manitoba Dauphin POINT (5632587.125 1698310.139)
179 Dawson Creek Airport medium_airport 55.742298 -120.182999 2148.0 British Columbia Dawson Creek POINT (4515245.571 2552123.737)
180 Hay River / Merlyn Carter Airport medium_airport 60.839699 -115.782997 541.0 Northwest Territories Hay River POINT (4966549.430 2958839.778)
181 La Ronge Airport medium_airport 55.151402 -105.262001 1242.0 Saskatchewan La Ronge POINT (5368662.303 2194186.695)
182 Norman Wells Airport medium_airport 65.281601 -126.797997 238.0 Northwest Territories Norman Wells POINT (4697302.683 3627694.991)
183 Red Lake Airport medium_airport 51.066898 -93.793098 1265.0 Ontario Red Lake POINT (6065996.295 1660036.522)
184 Sandspit Airport medium_airport 53.254299 -131.813995 21.0 British Columbia Sandspit POINT (3741383.484 2697199.562)
185 Schefferville Airport medium_airport 54.805302 -66.805298 1709.0 Quebec Schefferville POINT (7741192.855 2376132.329)
186 The Pas Airport medium_airport 53.971401 -101.091003 887.0 Manitoba The Pas POINT (5606643.145 2020412.495)
187 CFB Greenwood medium_airport 44.984402 -64.916901 92.0 Nova Scotia Greenwood POINT (8298573.025 1430161.308)
188 Edson Airport medium_airport 53.578899 -116.464996 3043.0 Alberta Edson POINT (4635216.459 2240716.410)
189 Geraldton Greenstone Regional Airport medium_airport 49.778301 -86.939400 1144.0 Ontario Geraldton POINT (6553487.686 1529118.495)
190 Rivière-du-Loup Airport medium_airport 47.764400 -69.584702 427.0 Quebec Rivière-du-Loup POINT (7844537.096 1582287.304)
195 Baie-Comeau Airport medium_airport 49.132500 -68.204399 71.0 Quebec Baie-Comeau POINT (7886395.307 1761067.761)
196 Flin Flon Airport medium_airport 54.678101 -101.681999 997.0 Manitoba Flin Flon POINT (5580803.971 2102491.202)
197 Fond-Du-Lac Airport medium_airport 59.334400 -107.181999 814.0 Saskatchewan Fond-Du-Lac POINT (5360132.185 2662776.104)
198 Moosonee Airport medium_airport 51.291100 -80.607803 30.0 Ontario Moosonee POINT (6974851.295 1751510.950)
199 Bathurst Airport medium_airport 47.629700 -65.738899 193.0 New Brunswick South Tetagouche POINT (8119513.662 1676081.652)
200 Stony Rapids Airport medium_airport 59.250301 -105.841003 805.0 Saskatchewan Stony Rapids POINT (5430438.194 2636934.904)
201 Earlton (Timiskaming Regional) Airport medium_airport 47.697401 -79.847345 800.0 Ontario Earlton POINT (7101529.569 1369201.017)
202 Pincher Creek Airport medium_airport 49.520599 -113.997002 3903.0 Alberta Pincher Creek POINT (4632878.153 1762235.142)
203 Port Hawkesbury Airport medium_airport 45.656700 -61.368099 377.0 Nova Scotia Port Hawkesbury POINT (8519762.020 1621772.628)
204 Whitecourt Airport medium_airport 54.143902 -115.787003 2567.0 Alberta Whitecourt POINT (4698989.018 2281811.572)
213 Baker Lake Airport medium_airport 64.298897 -96.077797 59.0 Nunavut Baker Lake POINT (6002517.820 3104694.345)
214 Fort Chipewyan Airport medium_airport 58.767200 -111.116997 761.0 Alberta Fort Chipewyan POINT (5131942.907 2662546.338)
215 Gaspé (Michel-Pouliot) Airport medium_airport 48.775299 -64.478600 112.0 Quebec Gaspé POINT (8153113.658 1831102.175)
216 Lac Du Bonnet Airport medium_airport 50.294399 -96.010002 850.0 Manitoba Lac Du Bonnet POINT (5906387.597 1582169.005)
217 Sioux Lookout Airport medium_airport 50.113899 -91.905296 1258.0 Ontario Sioux Lookout POINT (6197248.481 1552616.079)
218 Charlo Airport medium_airport 47.990799 -66.330299 132.0 New Brunswick Charlo POINT (8062690.380 1695558.745)
219 Mont-Tremblant International Airport medium_airport 46.409401 -74.779999 827.0 Quebec La Macaza POINT (7512131.817 1316738.479)
220 Miramichi Airport medium_airport 47.007801 -65.449203 108.0 New Brunswick Miramichi POINT (8167655.085 1621173.149)
221 Moose Jaw Air Vice Marshal C. M. McEwen Airport medium_airport 50.330299 -105.558998 1892.0 Saskatchewan Moose Jaw POINT (5237353.908 1680591.599)
222 Alert Airport medium_airport 82.517799 -62.280602 100.0 Nunavut Alert POINT (6634672.270 5217062.971)
223 Gimli Industrial Park Airport medium_airport 50.628101 -97.043297 753.0 Manitoba Gimli POINT (5836311.399 1624330.028)
224 Manitoulin East Municipal Airport medium_airport 45.842435 -81.857595 869.0 Ontario Sheguiandah POINT (6984735.858 1137515.571)
225 Downsview Airport medium_airport 43.742500 -79.465599 652.0 Ontario Toronto POINT (7216171.066 937342.903)
226 Yarmouth Airport medium_airport 43.826900 -66.088097 141.0 Nova Scotia Yarmouth POINT (8264291.493 1271700.162)
233 Attawapiskat Airport medium_airport 52.927502 -82.431900 31.0 Ontario Attawapiskat POINT (6823709.473 1909199.983)
234 Cambridge Bay Airport medium_airport 69.108101 -105.138000 90.0 Nunavut Cambridge Bay POINT (5689523.343 3672184.957)
235 Fort Simpson Airport medium_airport 61.760201 -121.237000 555.0 Northwest Territories Fort Simpson POINT (4747870.288 3165096.278)
236 Gjoa Haven Airport medium_airport 68.635597 -95.849701 152.0 Nunavut Gjoa Haven POINT (6042569.073 3572393.703)
237 Kapuskasing Airport medium_airport 49.413898 -82.467499 743.0 Ontario Kapuskasing POINT (6878481.714 1525204.144)
238 Masset Airport medium_airport 54.027500 -132.125000 25.0 British Columbia Masset POINT (3774976.614 2777580.041)
239 St. Anthony Airport medium_airport 51.391909 -56.083210 108.0 Newfoundland and Labrador St. Anthony POINT (8541111.445 2370340.628)
240 Texada Gillies Bay Airport medium_airport 49.694199 -124.517998 326.0 British Columbia Texada POINT (3952263.724 2096026.047)
241 Mackenzie Airport medium_airport 55.304402 -123.132004 2264.0 British Columbia Mackenzie POINT (4330856.613 2591887.813)
251 Îles-de-la-Madeleine Airport medium_airport 47.425242 -61.778612 35.0 Quebec Les Îles-de-la-Madeleine POINT (8400431.828 1783701.385)
252 Natashquan Airport medium_airport 50.189999 -61.789200 39.0 Quebec Natashquan POINT (8259571.112 2057280.167)
253 Uranium City Airport medium_airport 59.561401 -108.481003 1044.0 Saskatchewan Uranium City POINT (5296810.786 2704403.936)
254 Chapleau Airport medium_airport 47.820000 -83.346703 1470.0 Ontario Chapleau POINT (6839122.877 1340335.018)
255 Charlevoix Airport medium_airport 47.597500 -70.223900 977.0 Quebec Charlevoix POINT (7805450.112 1548402.540)
256 Estevan Airport medium_airport 49.210300 -102.966003 1905.0 Saskatchewan Estevan POINT (5396016.288 1522693.118)
257 Kindersley Airport medium_airport 51.517502 -109.181000 2277.0 Saskatchewan Kindersley POINT (5023609.522 1868834.479)
258 Rimouski Airport medium_airport 48.478100 -68.496902 82.0 Quebec Rimouski POINT (7892661.825 1685390.284)
273 Fort Frances Municipal Airport medium_airport 48.655749 -93.443490 1125.0 Ontario Fort Frances POINT (6083682.976 1392120.864)
274 Fort Good Hope Airport medium_airport 66.240799 -128.651001 268.0 Northwest Territories Fort Good Hope POINT (4683113.674 3759365.309)
275 Fort Smith Airport medium_airport 60.020302 -111.961998 671.0 Northwest Territories Fort Smith POINT (5128789.467 2806115.018)
276 Kasabonika Airport medium_airport 53.524700 -88.642799 672.0 Ontario Kasabonika POINT (6410494.698 1933709.601)
277 Kashechewan Airport medium_airport 52.282501 -81.677803 35.0 Ontario Kashechewan POINT (6884456.102 1846910.728)
278 Kugluktuk Airport medium_airport 67.816704 -115.143997 74.0 Nunavut Kugluktuk POINT (5267999.021 3651157.272)
279 Kuujjuarapik Airport medium_airport 55.281898 -77.765297 34.0 Quebec Kuujjuarapik POINT (7071321.874 2217550.851)
280 La Grande Rivière Airport medium_airport 53.625301 -77.704201 639.0 Quebec La Grande Rivière POINT (7115040.709 2041694.229)
281 Old Crow Airport medium_airport 67.570602 -139.839005 824.0 Yukon Old Crow POINT (4398430.558 4165559.207)
282 Resolute Bay Airport medium_airport 74.716904 -94.969398 215.0 Nunavut Resolute Bay POINT (6109732.237 4234138.171)
283 Roberval Airport medium_airport 48.520000 -72.265602 586.0 Quebec Roberval POINT (7627857.592 1597323.752)
284 Swan River Airport medium_airport 52.120602 -101.236000 1100.0 Manitoba Swan River POINT (5567566.521 1820823.274)
285 Wollaston Lake Airport medium_airport 58.106899 -103.171997 1360.0 Saskatchewan Wollaston Lake POINT (5553753.714 2485612.956)
286 Bella Bella (Campbell Island) Airport medium_airport 52.185001 -128.156994 141.0 British Columbia Bella Bella POINT (3876564.819 2462646.684)
287 Havre-Saint-Pierre Airport medium_airport 50.281898 -63.611401 124.0 Quebec Havre-Saint-Pierre POINT (8139034.589 2009124.806)
288 Hearst René Fontaine Municipal Airport medium_airport 49.714199 -83.686096 827.0 Ontario Hearst POINT (6786764.344 1546095.395)
289 Meadow Lake Airport medium_airport 54.125301 -108.523003 1576.0 Saskatchewan Meadow Lake POINT (5141422.974 2133559.192)
312 Deer Lake Airport medium_airport 52.655800 -94.061401 1092.0 Ontario Deer Lake POINT (6053377.361 1835543.552)
313 Fort Hope Airport medium_airport 51.561901 -87.907799 899.0 Ontario Fort Hope POINT (6471848.521 1721082.620)
314 Grise Fiord Airport medium_airport 76.426102 -82.909203 146.0 Nunavut Grise Fiord POINT (6433259.130 4437775.626)
315 Pickle Lake Airport medium_airport 51.446400 -90.214203 1267.0 Ontario Pickle Lake POINT (6313863.140 1701363.636)
316 Points North Landing Airport medium_airport 58.276699 -104.082001 1605.0 Saskatchewan Points North Landing POINT (5505869.265 2513318.531)
317 Rainbow Lake Airport medium_airport 58.491402 -119.407997 1759.0 Alberta Rainbow Lake POINT (4683837.295 2803233.909)
318 Tuktoyaktuk / James Gruben Airport medium_airport 69.433296 -133.026001 15.0 Northwest Territories Tuktoyaktuk POINT (4735552.729 4145124.482)
319 Alma Airport medium_airport 48.508900 -71.641899 445.0 Quebec Alma POINT (7672161.647 1610365.643)
320 Bella Coola Airport medium_airport 52.387501 -126.596001 117.0 British Columbia Bella Coola POINT (3977675.553 2425758.298)
321 Bonnyville Airport medium_airport 54.304199 -110.744003 1836.0 Alberta Bonnyville POINT (5009907.257 2191643.158)
322 Burns Lake Airport medium_airport 54.376400 -125.950996 2343.0 British Columbia Burns Lake POINT (4126242.020 2590949.174)
323 Atikokan Municipal Airport medium_airport 48.773899 -91.638603 1408.0 Ontario Atikokan POINT (6216777.397 1403863.267)
324 Bonaventure Airport medium_airport 48.071098 -65.460297 123.0 Quebec Bonaventure POINT (8118912.602 1729647.667)
325 Kirkland Lake Airport medium_airport 48.210300 -79.981400 1157.0 Ontario Kirkland Lake POINT (7080953.458 1423581.823)
345 Arviat Airport medium_airport 61.094200 -94.070801 32.0 Nunavut Arviat POINT (6084578.812 2753711.935)
346 Lourdes-de-Blanc-Sablon Airport medium_airport 51.443600 -57.185299 121.0 Quebec Blanc-Sablon POINT (8473476.317 2335210.736)
347 Cartwright Airport medium_airport 53.682501 -57.042303 40.0 Newfoundland and Labrador Cartwright POINT (8353790.932 2550451.863)
348 Déline Airport medium_airport 65.211098 -123.435997 703.0 Northwest Territories Déline POINT (4825498.930 3545031.714)
349 Fort Mcpherson Airport medium_airport 67.407501 -134.860992 116.0 Northwest Territories Fort Mcpherson POINT (4542818.388 4016796.591)
350 Inukjuak Airport medium_airport 58.471901 -78.076897 83.0 Quebec Inukjuak POINT (6977714.707 2552278.501)
351 Nemiscau Airport medium_airport 51.691101 -76.135597 802.0 Quebec Nemiscau POINT (7266450.854 1859414.226)
352 Norway House Airport medium_airport 53.958302 -97.844200 734.0 Manitoba Norway House POINT (5814576.266 1994001.380)
353 Pangnirtung Airport medium_airport 66.144997 -65.713600 75.0 Nunavut Pangnirtung POINT (7313290.421 3529893.460)
354 Pikangikum Airport medium_airport 51.819698 -93.973297 1114.0 Ontario Pikangikum POINT (6056215.125 1743409.974)
355 Qikiqtarjuaq Airport medium_airport 67.546232 -64.031754 21.0 Nunavut Qikiqtarjuaq POINT (7316137.706 3697583.394)
356 Hall Beach Airport medium_airport 68.776100 -81.242500 30.0 Nunavut Sanirajak POINT (6615713.513 3617504.490)
357 Alert Bay Airport medium_airport 50.582199 -126.916000 240.0 British Columbia Alert Bay POINT (3855073.758 2267376.764)
358 Cache Creek-Ashcroft Regional Airport medium_airport 50.775258 -121.321314 2034.0 British Columbia Cache Creek POINT (4208870.636 2095234.120)
359 Chetwynd Airport medium_airport 55.687199 -121.626999 2000.0 British Columbia Chetwynd POINT (4432814.481 2585915.543)
360 Digby / Annapolis Regional Airport medium_airport 44.545845 -65.785425 499.0 Nova Scotia Digby POINT (8254633.346 1356414.338)
361 Fort Resolution Airport medium_airport 61.180801 -113.690002 526.0 Northwest Territories Fort Resolution POINT (5082421.316 2954705.022)
362 Grand Forks Airport medium_airport 49.015598 -118.431000 1720.0 British Columbia Grand Forks POINT (4312958.727 1830602.025)
363 Stewart Airport medium_airport 55.935410 -129.982435 24.0 British Columbia Stewart POINT (4005216.636 2869865.746)
364 Virden / RJ (Bob) Andrew Field Regional Aerodrome medium_airport 49.878300 -100.917999 1454.0 Manitoba Virden POINT (5553761.346 1572566.329)
397 Cat Lake Airport medium_airport 51.727200 -91.824402 1344.0 Ontario Cat Lake POINT (6202892.019 1730839.055)
398 Chesterfield Inlet Airport medium_airport 63.346901 -90.731102 32.0 Nunavut Chesterfield Inlet POINT (6255125.454 2995761.199)
399 Chevery Airport medium_airport 50.468899 -59.636700 39.0 Quebec Chevery POINT (8379625.271 2156261.294)
400 Coral Harbour Airport medium_airport 64.193298 -83.359398 210.0 Nunavut Coral Harbour POINT (6599575.061 3113503.383)
401 Fort Albany Airport medium_airport 52.201401 -81.696899 48.0 Ontario Fort Albany POINT (6884604.701 1837897.005)
402 Fort Severn Airport medium_airport 56.018902 -87.676102 48.0 Ontario Fort Severn POINT (6455587.336 2209366.938)
403 Gillam Airport medium_airport 56.357498 -94.710602 476.0 Manitoba Gillam POINT (6028126.080 2241672.563)
404 Gods River Airport medium_airport 54.839699 -94.078598 627.0 Manitoba Gods River POINT (6060547.865 2074704.341)
405 Igloolik Airport medium_airport 69.364700 -81.816101 174.0 Nunavut Igloolik POINT (6583407.691 3676952.530)
406 Cape Dorset Airport medium_airport 64.230003 -76.526703 164.0 Nunavut Kinngait POINT (6914717.846 3177313.745)
407 Lynn Lake Airport medium_airport 56.863899 -101.075996 1170.0 Manitoba Lynn Lake POINT (5653142.248 2332606.767)
408 Nakina Airport medium_airport 50.182800 -86.696404 1057.0 Ontario Nakina POINT (6567243.287 1575180.371)
409 Pond Inlet Airport medium_airport 72.683296 -77.966698 181.0 Nunavut Pond Inlet POINT (6649802.697 4057740.204)
410 Salluit Airport medium_airport 62.179401 -75.667198 743.0 Quebec Salluit POINT (7009757.072 2972750.240)
411 Sandy Lake Airport medium_airport 53.064201 -93.344398 951.0 Ontario Sandy Lake POINT (6102309.018 1878998.468)
412 Shamattawa Airport medium_airport 55.865601 -92.081398 289.0 Manitoba Shamattawa POINT (6186837.430 2184258.335)
413 Tulita Airport medium_airport 64.909697 -125.572998 332.0 Northwest Territories Tulita POINT (4724547.468 3564522.741)
414 Waskaganish Airport medium_airport 51.473301 -78.758301 80.0 Quebec Waskaganish POINT (7096346.890 1795542.134)
415 Webequie Airport medium_airport 52.959393 -87.374868 685.0 Ontario Webequie POINT (6497538.831 1876869.007)
416 Wemindji Airport medium_airport 53.010601 -78.831100 66.0 Quebec Wemindji POINT (7057019.400 1960108.775)
417 Whale Cove Airport medium_airport 62.240002 -92.598099 40.0 Nunavut Whale Cove POINT (6163116.059 2875836.572)
418 York Landing Airport medium_airport 56.089401 -96.089203 621.0 Manitoba York Landing POINT (5942975.155 2217160.942)
419 Anahim Lake Airport medium_airport 52.451501 -125.303776 3635.0 British Columbia Anahim Lake POINT (4055964.402 2387454.384)
420 Atlin Airport medium_airport 59.576698 -133.669006 2348.0 British Columbia Atlin POINT (4064429.451 3315581.482)
421 Petawawa Airport medium_airport 45.952202 -77.319199 427.0 Ontario Petawawa POINT (7332516.837 1218084.086)
422 Dolbeau St Felicien Airport medium_airport 48.778500 -72.375000 372.0 Quebec Dolbeau-St-Félicien POINT (7611456.381 1622319.034)
423 Key Lake Airport medium_airport 57.256100 -105.617996 1679.0 Saskatchewan Key Lake POINT (5396092.406 2422841.982)
424 Little Grand Rapids Airport medium_airport 52.045601 -95.465797 1005.0 Manitoba Little Grand Rapids POINT (5955839.776 1772813.994)
425 Poplar River Airport medium_airport 52.996526 -97.274194 728.0 Manitoba Poplar River POINT (5842282.803 1885650.140)
426 Puvirnituq Airport medium_airport 60.050598 -77.286903 74.0 Quebec Puvirnituq POINT (6982629.070 2728850.282)
427 Saint-Léonard Airport medium_airport 47.157097 -67.836242 793.0 New Brunswick Saint-Léonard POINT (7992686.463 1566037.734)
428 St Augustin Airport medium_airport 51.211700 -58.658298 20.0 Quebec St-Augustin POINT (8398837.613 2261395.140)
477 Aklavik/Freddie Carmichael Airport medium_airport 68.223297 -135.005990 23.0 Northwest Territories Aklavik POINT (4593567.517 4089405.807)
478 Big Trout Lake Airport medium_airport 53.817799 -89.896896 729.0 Ontario Big Trout Lake POINT (6327651.523 1962467.215)
479 Gods Lake Narrows Airport medium_airport 54.558899 -94.491402 617.0 Manitoba Gods Lake Narrows POINT (6033270.036 2045030.287)
480 Ilford Airport medium_airport 56.051630 -95.620523 642.0 Manitoba Ilford POINT (5971225.644 2211263.592)
481 Island Lake Airport medium_airport 53.857201 -94.653603 770.0 Manitoba Island Lake POINT (6019609.779 1968758.691)
482 Nain Airport medium_airport 56.550778 -61.682224 22.0 Newfoundland and Labrador Nain POINT (7947472.859 2681467.597)
483 Paulatuk (Nora Aliqatchialuk Ruben) Airport medium_airport 69.360838 -124.075470 15.0 Northwest Territories Paulatuk POINT (5018028.856 3952003.945)
484 Peawanuck Airport medium_airport 54.988098 -85.443298 173.0 Ontario Peawanuck POINT (6602723.159 2108842.348)
485 Naujaat Airport medium_airport 66.521400 -86.224701 80.0 Nunavut Repulse Bay POINT (6443140.841 3349245.773)
486 Round Lake (Weagamow Lake) Airport medium_airport 52.943600 -91.312798 974.0 Ontario Round Lake POINT (6236733.698 1864784.649)
487 Sachigo Lake Airport medium_airport 53.891102 -92.196404 876.0 Ontario Sachigo Lake POINT (6178669.610 1968574.185)
488 Sachs Harbour (David Nasogaluak Jr. Saaryuaq) ... medium_airport 71.993896 -125.242996 282.0 Northwest Territories Sachs Harbour POINT (5122790.954 4222266.132)
489 Taloyoak Airport medium_airport 69.546700 -93.576698 92.0 Nunavut Taloyoak POINT (6135033.022 3667240.887)
490 Armstrong Airport medium_airport 50.290298 -88.909698 1058.0 Ontario Armstrong POINT (6409635.780 1577022.392)
491 Beaver Creek Airport medium_airport 62.410301 -140.867004 2131.0 Yukon Beaver Creek POINT (3979085.691 3794478.301)
492 Cochrane Airport medium_airport 49.105598 -81.013603 861.0 Ontario Cochrane POINT (6988296.558 1508146.158)
493 Cross Lake (Charlie Sinclair Memorial) Airport medium_airport 54.610600 -97.760803 709.0 Manitoba Cross Lake POINT (5826541.678 2064557.667)
494 Hornepayne Municipal Airport medium_airport 49.193100 -84.758904 1099.0 Ontario Hornepayne POINT (6716612.172 1479349.858)
495 Kelsey Airport medium_airport 56.037498 -96.509697 600.0 Manitoba Kelsey POINT (5917010.723 2213304.162)
496 Lac Brochet Airport medium_airport 58.617500 -101.469002 1211.0 Manitoba Lac Brochet POINT (5658628.076 2524383.432)
497 Teslin Airport medium_airport 60.172798 -132.742996 2313.0 Yukon Teslin POINT (4143639.882 3336468.632)
580 Akulivik Airport medium_airport 60.818600 -78.148598 75.0 Quebec Akulivik POINT (6919325.188 2799763.696)
581 Eastmain River Airport medium_airport 52.226398 -78.522499 24.0 Quebec Eastmain River POINT (7094960.724 1880025.522)
582 Hopedale Airport medium_airport 55.448757 -60.228124 39.0 Newfoundland and Labrador Hopedale POINT (8082080.869 2616758.516)
583 Ivujivik Airport medium_airport 62.417301 -77.925301 126.0 Quebec Ivujivik POINT (6893254.008 2971071.438)
584 Kangiqsualujjuaq (Georges River) Airport medium_airport 58.711399 -65.992798 215.0 Quebec Kangiqsualujjuaq POINT (7620223.941 2786537.411)
585 Kangirsuk Airport medium_airport 60.027199 -69.999199 403.0 Quebec Kangirsuk POINT (7361833.593 2837931.607)
586 Lutselk'e Airport medium_airport 62.418303 -110.681998 596.0 Northwest Territories Lutselk'e POINT (5270574.209 3033377.968)
587 Makkovik Airport medium_airport 55.077335 -59.187942 234.0 Newfoundland and Labrador Makkovik POINT (8158438.564 2612691.487)
588 Muskrat Dam Airport medium_airport 53.441399 -91.762802 911.0 Ontario Muskrat Dam POINT (6206799.401 1919247.190)
589 Oxford House Airport medium_airport 54.933300 -95.278900 663.0 Manitoba Oxford House POINT (5985482.439 2088260.245)
590 Sanikiluaq Airport medium_airport 56.537800 -79.246696 104.0 Nunavut Sanikiluaq POINT (6954080.115 2332514.316)
591 St. Theresa Point Airport medium_airport 53.845600 -94.851898 773.0 Manitoba St. Theresa Point POINT (6006724.188 1968071.925)
592 Ulukhaktok Holman Airport medium_airport 70.762802 -117.806000 117.0 Northwest Territories Ulukhaktok POINT (5293961.363 3986007.431)
593 Umiujaq Airport medium_airport 56.536098 -76.518303 250.0 Quebec Umiujaq POINT (7114266.226 2368120.428)
594 Berens River Airport medium_airport 52.358898 -97.018303 728.0 Manitoba Berens River POINT (5853504.347 1814415.075)
595 Brochet Airport medium_airport 57.889400 -101.679001 1136.0 Manitoba Brochet POINT (5634738.757 2448101.442)
596 Kangiqsujuaq (Wakeham Bay) Airport medium_airport 61.588600 -71.929398 501.0 Quebec Kangiqsujuaq POINT (7210733.625 2964906.069)
597 Kugaaruk Airport medium_airport 68.534401 -89.808098 56.0 Nunavut Kugaaruk POINT (6281759.858 3557810.065)
598 Tadoule Lake Airport medium_airport 58.706100 -98.512199 923.0 Manitoba Tadoule Lake POINT (5825589.206 2512627.944)
599 Amos/Magny Airport medium_airport 48.563903 -78.249702 1068.0 Quebec Amos POINT (7199096.480 1487805.769)
600 Blue River Airport medium_airport 52.116699 -119.282997 2240.0 British Columbia Blue River POINT (4399478.756 2167893.265)
601 Burwash Airport medium_airport 61.371101 -139.041000 2647.0 Yukon Burwash Landing POINT (3969788.093 3648816.984)
602 Forestville Airport medium_airport 48.746101 -69.097198 293.0 Quebec Forestville POINT (7840624.095 1697567.249)
603 Fort Liard Airport medium_airport 60.235802 -123.469002 708.0 Northwest Territories Fort Liard POINT (4567770.507 3072845.928)
604 Haines Junction Airport medium_airport 60.789200 -137.546005 2150.0 Yukon Haines Junction POINT (3986191.590 3549669.620)
605 La Grande-4 Airport medium_airport 53.754700 -73.675301 1005.0 Quebec La Grande-4 POINT (7365026.840 2121322.294)
606 Matagami Airport medium_airport 49.761700 -77.802803 918.0 Quebec Matagami POINT (7202161.918 1624826.246)
607 Matane Airport medium_airport 48.856899 -67.453300 102.0 Quebec Matane POINT (7948791.811 1752862.622)
608 Mayo Airport medium_airport 63.616402 -135.867996 1653.0 Yukon Mayo POINT (4248788.934 3727566.126)
609 Nipawin Airport medium_airport 53.332500 -104.008003 1220.0 Saskatchewan Nipawin POINT (5407730.468 1983145.516)
610 Pikwitonei Airport medium_airport 55.588902 -97.164200 630.0 Manitoba Pikwitonei POINT (5873137.313 2167684.404)
611 Port Menier Airport medium_airport 49.836399 -64.288597 167.0 Quebec Port-Menier POINT (8116285.882 1943922.278)
612 Pukatawagan Airport medium_airport 55.749199 -101.265999 958.0 Manitoba Pukatawagan POINT (5624066.213 2214177.495)
613 Red Sucker Lake Airport medium_airport 54.167198 -93.557198 729.0 Manitoba Red Sucker Lake POINT (6091456.648 2000186.877)
614 South Indian Lake Airport medium_airport 56.792801 -98.907204 951.0 Manitoba South Indian Lake POINT (5780464.409 2308455.956)
615 Tasiujaq Airport medium_airport 58.667801 -69.955803 122.0 Quebec Tasiujaq POINT (7413800.050 2700052.084)
616 Thicket Portage Airport medium_airport 55.318901 -97.707802 678.0 Manitoba Thicket Portage POINT (5836985.065 2141286.710)
742 Aupaluk Airport medium_airport 59.296700 -69.599701 119.0 Quebec Aupaluk POINT (7409335.358 2770954.024)
743 Clyde River Airport medium_airport 70.486099 -68.516701 87.0 Nunavut Clyde River POINT (7030752.127 3922747.129)
744 Kimmirut Airport medium_airport 62.848253 -69.877853 175.0 Nunavut Kimmirut POINT (7264619.723 3127250.837)
745 Lansdowne House Airport medium_airport 52.195599 -87.934196 834.0 Ontario Lansdowne House POINT (6465725.975 1790629.080)
746 Mary's Harbour Airport medium_airport 52.302837 -55.847626 38.0 Newfoundland and Labrador Mary's Harbour POINT (8501017.279 2463709.941)
748 Herschel Island Field medium_airport 69.548229 -139.091608 19.0 Yukon Herschel Island (Yukon Territory) POINT (4566112.682 4302570.387)
750 Ekati Airport medium_airport 64.698898 -110.614998 1536.0 Northwest Territories Ekati POINT (5345393.441 3268257.367)
751 Faro Airport medium_airport 62.207500 -133.376007 2351.0 Yukon Faro POINT (4250075.976 3531956.768)
752 Manitouwadge Airport medium_airport 49.083900 -85.860603 1198.0 Ontario Manitouwadge POINT (6637942.040 1459009.029)
753 Nejanilini Lake Airport medium_airport 59.487499 -97.780296 1000.0 Manitoba Nejanilini Lake POINT (5874563.001 2592901.741)
754 Ross River Airport medium_airport 61.970600 -132.423004 2314.0 Yukon Ross River POINT (4273270.712 3482448.067)
755 Wrigley Airport medium_airport 63.209400 -123.436996 489.0 Northwest Territories Wrigley POINT (4722433.427 3354814.996)
1097 Rae Lakes Airport medium_airport 64.116096 -117.309998 723.0 Northwest Territories Gamètì POINT (5029851.400 3315607.765)
1098 Quaqtaq Airport medium_airport 61.046398 -69.617798 103.0 Quebec Quaqtaq POINT (7343468.037 2948591.170)
1099 Bamfield Airstrip medium_airport 48.820600 -125.119300 232.0 British Columbia Bamfield POINT (3866209.432 2033355.849)
1100 Ignace Municipal Airport medium_airport 49.428204 -91.720418 1435.0 Ontario Ignace POINT (6210591.861 1476583.274)
1101 Jenpeg Airport medium_airport 54.518902 -98.046097 729.0 Manitoba Jenpeg POINT (5807548.350 2056295.232)
1102 Leaf Rapids Airport medium_airport 56.513302 -99.985298 959.0 Manitoba Leaf Rapids POINT (5712676.024 2285936.763)
In [79]:
#unimos las geometrías de los aeropuertos medianos
medium_airport.unary_union
Out[79]:
In [81]:
#convertimos en multipunto
gpd.GeoSeries(medium_airport.unary_union)
Out[81]:
0    MULTIPOINT (3741383.484 2697199.562, 3774976.6...
dtype: geometry
In [82]:
medium_airport.unary_union.convex_hull
Out[82]:
In [83]:
type(medium_airport.unary_union.convex_hull)
Out[83]:
shapely.geometry.polygon.Polygon
In [85]:
#Aplicamos el código para plotear, el cual funciona para una geoserie
gpd.GeoSeries(medium_airport.unary_union.convex_hull).plot()
Out[85]:
<Axes: >
In [86]:
# convertimos en gdf la geoSerie
MediumAirport_hull=gpd.GeoSeries(medium_airport.unary_union.convex_hull).to_frame()
MediumAirport_hull
Out[86]:
0
0 POLYGON ((6955821.325 723539.072, 4312958.727 ...
In [88]:
#renombramos la columna 0
MediumAirport_hull.rename(columns={0:'geometry'},inplace=True)
#a la columna name le agregamos el valor de "medium airport hull"
MediumAirport_hull['name']='medium airport hull'
MediumAirport_hull=MediumAirport_hull.set_geometry('geometry')
#asignamos el crs
MediumAirport_hull.crs="EPSG:3347"
# verificamos la aplicación:
MediumAirport_hull.crs
Out[88]:
<Projected CRS: EPSG:3347>
Name: NAD83 / Statistics Canada Lambert
Axis Info [cartesian]:
- E[east]: Easting (metre)
- N[north]: Northing (metre)
Area of Use:
- name: Canada - onshore and offshore - Alberta; British Columbia; Manitoba; New Brunswick; Newfoundland and Labrador; Northwest Territories; Nova Scotia; Nunavut; Ontario; Prince Edward Island; Quebec; Saskatchewan; Yukon.
- bounds: (-141.01, 38.21, -40.73, 86.46)
Coordinate Operation:
- name: Statistics Canada Lambert
- method: Lambert Conic Conformal (2SP)
Datum: North American Datum 1983
- Ellipsoid: GRS 1980
- Prime Meridian: Greenwich
In [95]:
base=canada_3347.plot(facecolor='turquoise')
medium_airport.plot(ax=base)
MediumAirport_hull.plot(ax=base,facecolor='mediumpurple',
                       edgecolor='white',alpha=0.4,
                       hatch='X')
Out[95]:
<Axes: >
In [96]:
MediumAirport_hull.explore()
Out[96]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [97]:
#Ejercicio 7
In [4]:
#Imprimimos que geometrías de las provincias no son válidas
canada_provinces[~canada_provinces.is_valid]
Out[4]:
PRUID DGUID PRNAME PRENAME PRFNAME PREABBR PRFABBR LANDAREA geometry
5 35 2021A000235 Ontario Ontario Ontario Ont. Ont. 8.924118e+05 MULTIPOLYGON (((7146731.034 1071348.914, 71467...
12 62 2021A000262 Nunavut Nunavut Nunavut Nvt. Nt 1.836994e+06 MULTIPOLYGON (((6990267.260 1768670.111, 69902...
In [5]:
#Graficamos la invalidez
canada_provinces[~canada_provinces.is_valid].plot()
Out[5]:
<Axes: >
In [6]:
#corregimos las geometrías
from shapely.validation import explain_validity, make_valid

explain_validity(canada_provinces[~canada_provinces.is_valid].geometry)
Out[6]:
5     Ring Self-intersection[7159707.12571432 104516...
12    Ring Self-intersection[6367091.37142861 401805...
Name: geometry, dtype: object
In [ ]:
#creamos una copia a las geometrías inválidas
CanadaProv_valid=canada_provinces[~canada_provinces.is_valid].copy()
#Resolvemos el problema
CanadaProv_valid['geometry'] = [make_valid(row)  if not row.is_valid else row for row in canada_provinces['geometry'] ]
In [102]:
#Imprimimos que geometrías de las provincias no son válidas
canada_census[~canada_census.is_valid]
Out[102]:
CDUID DGUID CDNAME CDTYPE LANDAREA PRUID geometry
179 3543 2021A00033543 Simcoe CTY 4818.9317 35 MULTIPOLYGON (((7177118.911 1047854.583, 71771...
180 3544 2021A00033544 Muskoka DM 3839.4716 35 MULTIPOLYGON (((7146731.034 1071348.914, 71467...
290 6204 2021A00036204 Qikiqtaaluk REG 970554.6112 62 MULTIPOLYGON (((6990267.260 1768670.111, 69902...
292 6208 2021A00036208 Kitikmeot REG 432108.0040 62 MULTIPOLYGON (((5541699.500 3510034.311, 55416...
In [112]:
#Graficamos la invalidez
canada_census[~canada_census.is_valid].plot()
Out[112]:
<Axes: >
In [ ]:
# verificamos los tipos de validez de las geometrías de censos
canada_census['validity']=[x.split('[')[0] for x in canada_census.geometry.apply(lambda x: explain_validity(x))]
canada_census['validity'].value_counts()
In [ ]:
#eliminamos la columna validity
canada_census.drop(columns=['validity'],inplace=True)
#creamos una copia de los censos
CanadaCensus_valid=canada_census.copy()
#Se realizan las correcciones a las geometrías no válidas
CanadaCensus_valid['geometry'] = [make_valid(row)  if not row.is_valid else row for row in CanadaCensus_valid['geometry'] ]
#verificamos si hay geometrías inválidas en la nueva data
CanadaCensus_valid[~CanadaCensus_valid.is_valid]
In [ ]:
#Vemos la lista de geometrías obtenidas en la data
[x for x in CanadaCensus_valid["geometry"]]